How do I reference the python plugins script PATH "C:\Program Files\KiCad\7.0\bin\scripting\plugins\"?

When running a BOM export script from Eeschema, use is made of other python scripts from
C:\Program Files\KiCad\7.0\bin\scripting\plugins

When using a standard script, no path information is needed for using utility scripts, for instance
import kicad_utils

I’d like to place a python BOM export script in a directory of my choice - for example it might go in the same directory as the kicad project.
In a multi-user environment, what is the preferred way to reference the path to the standard utility scripts?

So far, the non-ideal solution I have used is to copy the utility scripts to the same directory as my customised script.

Maybe I can hard-code the path -

Import the KiCad python helper module and the csv formatter

import C:\Program Files\KiCad\7.0\bin\scripting\plugins\kicad_netlist_reader

That is also non-ideal as it needs updating if the KiCad version changes for example.

Pythonic way to handle this is to add it to your PYTHONPATH env variable and have your scripts import kicad_netlist_reader from global namespace (i.e. without a leading dot).

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.