Python kiutils bus nets

I’m trying to get a list of busses and what is connected to them.
I suspect this has been done, I’m hoping someone here can point me to the existing solution.

I found this kiutils, looked over the examples and docs - it seems relevant, but I haven’t dived into it yet.
https://kiutils.readthedocs.io/en/latest/module/kiutils.html#kiutils.schematic.Schematic.busEntries

my goal is to create some documentation that can be reviewed to verify that I have done things right.

For instance, I am making a JTAG host out of a pi-pico and hooking it to the jtag of a Pi (zero, 2, 3 or 4) I came up with this plan:

| name| pi gpio | pi pin | pico pin | pico gpio |
| ---  | --- | --- | --- | --- |
| TRST | 22 | 15 | 15 | 11 |
| RTCK | 23 | 16 | 14 | 10 |
| TDO | 24 | 18 | 12 | 9 |
| TCK | 25 | 22 | 11 | 8 |
| TDI | 26 | 37 | 10 | 7 |
| TMS | 27 | 13 | 9 | 6 |
| RST | | | | |

nice render: pin maps · CarlFK/pj Wiki · GitHub

export netlist, I see:

  (nets
    (net (code "1") (name "/RTCK")
      (node (ref "A1") (pin "14") (pinfunction "GPIO10") (pintype "bidirectional"))
      (node (ref "J1") (pin "16") (pinfunction "BCM23") (pintype "bidirectional")))
    (net (code "2") (name "/TCK")
      (node (ref "A1") (pin "11") (pinfunction "GPIO8") (pintype "bidirectional"))
      (node (ref "J1") (pin "22") (pinfunction "BCM25") (pintype "bidirectional")))
    (net (code "3") (name "/TDI")
      (node (ref "A1") (pin "10") (pinfunction "GPIO7") (pintype "bidirectional"))
      (node (ref "J1") (pin "37") (pinfunction "BCM26") (pintype "bidirectional")))
    (net (code "4") (name "/TDO")
      (node (ref "A1") (pin "12") (pinfunction "GPIO9") (pintype "bidirectional"))
      (node (ref "J1") (pin "18") (pinfunction "BCM24") (pintype "bidirectional")))
    (net (code "5") (name "/TMS")
      (node (ref "A1") (pin "9") (pinfunction "GPIO6") (pintype "bidirectional"))
      (node (ref "J1") (pin "13") (pinfunction "BCM27") (pintype "bidirectional")))
    (net (code "6") (name "/TRST")
      (node (ref "A1") (pin "15") (pinfunction "GPIO11") (pintype "bidirectional"))
      (node (ref "J1") (pin "15") (pinfunction "BCM22") (pintype "bidirectional")))

I found some python to parse it, but I don’t understand how to reference what I need.

net = KicadPCB.load(‘…/project/pj.net’)

net.nets.net[0].code
‘“1”’
net.nets.net[0].node[0].pin
‘“14”’