How to add footprint programmatically

Hello! I am trying to add a footprint to Footprint Libraries programmatically. I thought I can edit fp-lib-table file and add a new footprint but when I’ve done it, I need to restart KiCad to see it under Footprint Libraries. I think Add footprints button on KiCad loads fp-lib-table file only when KiCad launched or a footprint is added/removed with Manage Footprint Libraries. Is there a way to reload fp-lib-table file?

The fp-lib-table is for adding a new library. (But no, there’s no way to reload it other than restarting.)

However, you should be able to add a new footprint to an existing library and have it be picked up…

There kind of is. One can open the library manager and press ok in it to force re reading of footprints. This works in 5.1.5 and i do it regularly when reviewing library changes.

1 Like

That reloads footprints. It won’t reload the footprint library table.

I couldn’t find any guide to how to do it in KiCad 5. Do you know how can I do it? I have tried to load a footprint file through python but it is not making the footprint visible in “Add footprints” section. I can only place it on pcb this way.

I have the feeling you do not fully understand kicads library system. Maybe this will help: Library management in KiCad version 5

The short version of what i assume you miss:
Footprints are only available in the add footprint dialog if they are placed inside a library that is known to KiCad. Which means they need to be stored in a .pretty directory (reachable by your file system, which most likely means somewhere on your hard drive). You also need to point to this .pretty directory from the library table.

You can load footprints into the pcb without them being available to that dialog because your python script stores them directly into the pcb file instead of into a library. (or at least this is how i understand your description)

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