Help new plugin

Hi, I’m trying to write a plugin for KiCad with PyCharm. I have no idea about Python yet, so I took an existing plugin and this help file: PcbNew Plugins | Developer Documentation | KiCad
import pcbnew → ClassModul not found. (14.7 KB)

Which platform are you working on? Win, Linux or Mac? On Win or Mac you have to tell pycharm to use the interpreter that comes bundled with KiCad. Also it is quite handy to split the plugin code into the business logic and GUI, so that you can run, test and debug business logic within pycharm.

Also the pcbnew python API documentation will come in handy.

If you’re just getting started you should start with something simple (e.g. load a board, get all footprints, select specific footprints, count the number of pads of this footprint)

1 Like

I work with Windows. Where can I find the KiCad interpreter?
And thanks for the link to the documentation.

I found it and changed it

The python interpreter is in the KiCad installation folder. Just point it to python.exe. Once you do, pycharm will need a while before you can start debugging as it needs to index what packages are available in this interpreter.

What are you up to if it is not a secret?

So I want to learn Python and nothing is easier when you take on a project. I recently sat for hours creating two files to upload to But I didn’t want to start from scratch, so I took an existing plugin and first removed the obvious errors that were displayed to me and then modified it as described for jlcpcb. It all worked so far. The two files were created and then I made an error that I cannot understand.
My log file says that:
Traceback (most recent call last):
File “C:\Users/Lutz Müller/Documents/KiCad/6.0/scripting\plugins\”, line 5, in
from .JLCPCB_action import ActionJLCPCB
File “C:\Users/Lutz Müller/Documents/KiCad/6.0/scripting\plugins\JLCPCB_pcb\”, line 8, in
from JLCPCB_main import create_pcba
ModuleNotFoundError: No module named ‘JLCPCB_main’

How do you have to fix this? (19.6 KB)

Try inserting a dot(.) before the module name. I seem to recall that this has something to do with python import system
so from JLCPCB_main import create_pcba should become from .JLCPCB_main import create_pcba