How to fix KiCad footprint generator ModuleNotFoundError: No module named 'KicadModTree'

Problem

When you run a kicad-footprint-generator script such as ./ipc_bga_generator.py, you see an error message such as

Traceback (most recent call last):
  File "/home/user/kicad-footprint-generator/scripts/Packages/Package_BGA/./ipc_bga_generator.py", line 10, in <module>
    from KicadModTree import (
ModuleNotFoundError: No module named 'KicadModTree'

Solution

The KicadModTree module is part of the kicad-footprint-generator repository.

Open a terminal and navigate to the root directory of the kicad-footprint-generator repository in your terminal and run

./manage.sh update_dev_packages

You can (optionally) run this in a virtual environment. For instructions, see the README.

After running ./manage.sh update_dev_packages, you should be able to run the script (e.g. ./ipc_bga_generator.py) without seeing the error message.