Python scripting: reload current board?

Hello,

I have written a simple script for component placement in Pcbnew using new Python API. It works, however I haven’t found a way to reload board in Pcbnew. When I make modifications to the board using script, changes aren’t visible until I close and open Pcbnew (since there’s no reload button). This is really annoying.

Is there a way to reload board automatically?

I remember someone else having this problem as well months back…

Best bet (if you don’t get answers here) is to try the developers directly here:

One get’s answers there now and then :wink:

I found:
pcbnew.Refresh()
at the end of the script worked.

1 Like

Hi @jbiondo. I tried to spawn a thread and calling pcbnew.Refresh() from there and KiCad crashed. Do you know any workaround to call pcbnew.Refresh from a thread and not just at the end of the script? Thank you.

I responded to your private message but will repeat here for others who stumble on this thread in the future.
Use wx.CallAfter

wx.CallAfter(pcbnew.Refresh)

2 Likes