Getting started using Python Scripts

Basics are explained here.

As an example of existing relatively complex plugins you can look here and here and here

To answer some of your questions

  1. Where you put it should work Put it in KiCad/share/kicad/scripting/plugins, look at complete list of paths in the doc I linked above
  2. Also explained in the doc. If you did everything right it will appear in pcbnew under tools->external plugins. If it doesn’t you can find some debug info by entering this in scripting console:
import pcbnew
print pcbnew.GetWizardsBackTrace()

It will show any exceptions that happened when importing your plugin.
3. On linux KiCad uses system python, on other platforms KiCad is shipped with it’s own python.
4. You don’t have to, see first doc I linked.
5. Be prepared to have to read c++ source code, python API is not well documented. Look at other plugins for help, @mmccoo’s blog also has lots of info on kicad scripting. Some of it is already outdated because API is not that stable, so again you will have to read c++ source code.

3 Likes