There is no way to debug action plugin when it’s running inside kicad. Because there is no python interpreter running as any python debugger would expect, instead python code is executed from python c bindings so it runs as part of kicad executable.
What you can do is
- Universal “printf debug” method. I.e. add logging statements in critical points of your plugin to understand what is state of the code, what parts are reachable, etc. In case of kicad plugins I usually use
wx.MessageBox() to pop a window with the log message because stdout is not visible on windows. If you are on linux/mac simple
print should work fine.
- Add CLI entry point to your plugin essentially executing it as a simple script. For most plugins that are not interactive and just need to read/write the board once this works fine. Pass the board to the script as a command line argument and read it using
Then you can debug your CLI script as usual and with it the plugin code.
I use both methods for InteractiveHtmlBom plugin.
You don’t need one, just create a dialog/window and call
Show()/ShowModal() on it. It will not have correct parent relationship to the pcbnew window but it doesn’t cause issues.
If your question is about how to create a dialog in the first place, well thats a long topic and you should read wxpython docs and examples. There is also wxFormBuilder that is frequently used to generate code for the form itself so that only thing you have to do is implement handlers for the events. Saves time on hand crafting all the buttons, panels, sizers etc.