Python issue

i want to try some python to change the netclass for some net, but it does not work,
pls give me some suggestion

board = pcbnew.GetBoard()
nets_by_name = board.GetNetsByName()
net_info = nets_by_name[“GND”]
net_info.SetNetClass(board.GetNetClasses()[“love”] )

Could you please post the version of Kicad and python you are using and any error messages you recieve

kicad9.02,no any error message.

First:
The the Font for the Quotes you’re using Errors on my system. If I delete the Quotes and add new one’s, then No Error.

That said, there’s a good little plugin for changing the Nets. Use it or learn from it…

It’s posted here (It’s not my plugin)

UPDATE: I’m ashamed of myself for using someone else’s plugin but saw no reason to not use it. I did add it to my Plugin’s/GUI and will cleanup the Icon’s but will live with it for a little while, mostly because I made a ‘Fishing Net’ Icon for it that makes me laugh… :rofl: