In Blender/Python 2.8, I am trying to create an image texture node for an object. The last line of the code below throws this error:
AttributeError: 'NoneType' object has no attribute 'inputs'
I tried replacing 'Diffuse BSDF' with 'ShaderNodeTexImage' and it still threw the same error.
Your suggestions would be much appreciated. Thanks in advance.
material = bpy.data.materials.get(material_name)
if material is None:
material = bpy.data.materials.new(material_name)
material.use_nodes=True
nodes = material.node_tree.nodes
material_output = nodes.get("Material Output")
path=TextureFolder+TextureFilenamePost
imgTex = bpy.data.images.load(path)
node_texture = nodes.new(type='ShaderNodeTexImage')
node_texture.image = imgTex
node_texture.location = 0,200
links = material.node_tree.links
link = links.new(node_texture.outputs[0], nodes.get("Diffuse BSDF").inputs[0])