Changing Roughness value in python script has no effect I'm able to modify the roughness property while inside blender to achieve different effects (renders shown below)



However, no matter what I set the value in the code the output is always the same:

What do I need to do in order to apply the roughness in a python script and have it stick? The code sample is below where I'm setting the roughness to 1.
for m in bpy.data.materials:
print(&quot;Going to clear out spec and metallic and roughness [%s] [%s] [%s] for %s&quot; % (m.specular_intensity, m.metallic, m.roughness, m.name))
m.specular_intensity = 0.0
m.metallic = 1.0
m.roughness = 1.0
Aha!
So in case anyone else comes across this
to debug this I checked the property path by right clicking in blender on the property and selected &quot;copy data path&quot; which gave me this value:
nodes[&quot;Principled BSDF&quot;].inputs[7].default_value

So I updated my script accordingly:
for m in bpy.data.materials:
m.node_tree.nodes[&quot;Principled BSDF&quot;].inputs[7].default_value = 1