Detach node links by node name?

I’m making a script that I want to attach or detach links between a texture node’s output and a shader node. I have it working to make links between them using[0], diffuse_tex.outputs[0]). But I cannot figure out how to detach them or otherwise cut the link. Is there some other material.node_tree.links thing I can use?


link = node_tree.nodes['Material Output'].inputs['Surface'].links[0]
1 Like