run_kicad_script
Run Python code with KiCad's API pre-loaded to perform custom actions on live PCB or board files when built-in tools fall short.
Instructions
Execute Python with the KiCad API pre-imported. Use this for anything the curated tools do not cover.
Available names: kicad (live KiCad client), board (open board, or None),
kipy, pcbnew, and sexpr for KiCad file parsing.
Print output is captured; assign to result to return a value.
This runs arbitrary local code with your privileges. Do not import kipy.schematic - it is broken in kipy 0.7.1 and KiCad 10 has no schematic API anyway.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| code | Yes | ||
| timeout | No |