KiCad Plugin With Python
Contents
Preparation
✅ Install KiCad ✅ Python & wxPython knowledge
Quick Start
⦿ Create a blank project ▷ Open "PCB Editor" ▷ Click "Show the Python scripting console".

⦿ Enter the following command at "2".
>>> import wx ↩️
>>> wx.MessageBox("Hello World") ↩️

Create A Hello World Plugin
⦿ Create a Hello_World.py file. ⦿ Enter the following code.
import pcbnew
import os
import wx
class SimplePlugin(pcbnew.ActionPlugin):
def defaults(self):
self.name = "Hello World"
self.category = "A descriptive category name"
self.description = "A description of the plugin and what it does"
self.show_toolbar_button = False # Optional, defaults to False
def Run(self):
# The entry function of the plugin that is executed on user action
wx.MessageBox("Hello World")
SimplePlugin().register() # Instantiate and register to Pcbnew
⦿ put it in: Windows: ...\Documents\KiCad\6.0\scripting\plugins\ MacOS: .../Documents/KiCad/6.0/scripting/plugins/ ⦿ Open PCB Editor ▷ Tools ▷ External Plugins ▷ Hello World

Show "Hello World" OK ↩️
