footprint.SetSelected() is not making footprint selected (Kicad 6)

Im in Kicad 6.0.2 and I’m trying to write script that selects multiple footprints:

import pcbnew
board = pcbnew.GetBoard()
footprints = board.GetFootprints()
footprints[0].GetReference() # this prints R1
footprints[0].SetSelected() # nothing happens
pcbnew.Refresh() # nothing happens

R1 remains unselected. How to select footprints in script in kicad 6? Thanks.

footprints[0].SetSelected(True) prints error: TypeError: EDA_ITEM.SetSelected() takes 1 positional argument but 2 were given

Why? V6 is two years obsolete and 6.0.2 is an early and buggy release of V6

1 Like

I remember fixing some bugs in kicad related to selection from python in v7. Make sure to update your kicad and do your changes from plugin, not a script, there is special logic synchronizing internal selection state that runs after the plugin completes, it is necessary to have the selection show up correctly in pcb editor.

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