I am terribly confused why this is not working. I have followed similar examples and failed (i.e. Blender scripting connect nodes)

bpy.context.active_object.active_material.node_tree.links.new(bpy.data.materials["Material.001"].node_tree.nodes["Principled BSDF"].inputs[0], bpy.data.materials["Material.001"].node_tree.nodes["ShaderNodeTexCoord"].outputs[0])

If my code is too difficult to decipher, here's a summary: I am just trying to link the Texture Coordinate node output to the Base Color input of the Principled BSDF.

I wrote out the whole line above without using any variables in the aid of clarity/searchability.

Thank you all!

  • $\begingroup$ Your last part includes .from_node. which is not correct offhand. $\endgroup$
    – Ratt
    Apr 13, 2021 at 21:55
  • $\begingroup$ Thanks for this, I have tried without as well. Same result. I will edit the question above for clarity. $\endgroup$ Apr 13, 2021 at 22:13
  • $\begingroup$ did you select an object when running your script? $\endgroup$
    – Chris
    Apr 14, 2021 at 6:23
  • $\begingroup$ what is the error of python? $\endgroup$
    – Chris
    Apr 14, 2021 at 7:15
  • $\begingroup$ Re clarity and search ability, not convinced it has have achieved either. $\endgroup$
    – batFINGER
    Apr 14, 2021 at 17:57

1 Answer 1


make sure your name is set to right value, not just the label.

"enter image description here

  • $\begingroup$ If the active objects active material is not material "Material.001" then code in question won't work... could be another guess-timate. $\endgroup$
    – batFINGER
    Apr 14, 2021 at 20:01
  • $\begingroup$ Nobody with little python experience would code it in that way - so I totally agree with you $\endgroup$
    – Chris
    Apr 15, 2021 at 0:28

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .