It there an example of setting the parent of one shaderNode with another?
Here I am trying to make the Bsdf Principled Node the parent of the Material Output node.
mat = bpy.data.materials.new(mat_name)
mat.use_nodes = True
nodes = mat.node_tree.nodes
m = nodes['Material Output']
d = nodes.new('ShaderNodeBsdfPrincipled')
mat.node_tree.links.new(d.outputs['BSDF'], m.inputs['Surface'])
d = nodes['Principled BSDF']
m.parent = d
When I check the value of m.parent before the assignment and after the assignment the value returned on None
I would have thought that the parenting and child process of Node should be intrinsically built into blender and if something has an output that comes from an input the parent/child relationship. I suspect blender only fills that in when you edit it through the GUI and not via python.
parentproperty just reflects whether the node is parented to a backdrop aka Frame node within the node editor, in fact there is no parent-child relationship. If you want to manipulate a shader via python have a look into: Control Cycles material nodes and material properties in Python – brockmann Feb 26 '19 at 09:19