Changing a value node in many materials with a python script Blender and python newbee here.
I would be very happy if one of you could help me with the following problem i am running into:
i have imported a scale model into blender, which i want to render in real life scale. When i scale the model, the materials do not scale with it and look bad. The materials however all have a Value node named &quot;Scale&quot;, which, if i edit it with the same scale i am scaling the model, fixes everything and it looks right then. 
It would be so much easier to have a script to do that semi-automatically, as the model uses way over 100 objects with different materials...
What i could find was this kind of similar problem solved, but i have not been able to adapt it to solve my problem, as i have no prior experience with scripting.
What i would like to do:

Select the objects i want to change
Go into scripting
copy a script into it
edit a number that should be put into the value node labeled &quot;scale&quot; of all selected objects
run script
be happy to get way better rendering results.

I am using Blender 2.83.4, in scripting the console says PYTHON INTERACTIVE CONSOLE 3.7.4 (default, Feb 17 2020, 16:23:28) [MSC v.1916 64 bit (AMD64)]
Every help is much appreciated!
The script below iterates over all selected objects and adjusts the value nodes in the assigned materials if their label is set to &quot;Scale&quot;.
import bpy
      
       
def set_scale_nodes_selected_objects(scale_val):
    for obj in bpy.context.selected_objects:
        for mat_slot in obj.material_slots:
            set_scale_nodes_material(mat_slot.material, scale_val)
    

def set_scale_nodes_material(mat, scale_val):
    if mat is not None and mat.use_nodes and mat.node_tree is not None:
        for node in mat.node_tree.nodes:
            if node.label == &quot;Scale&quot; and node.type == &quot;VALUE&quot;:
                node.outputs[&quot;Value&quot;].default_value = scale_val  


if __name__ == &quot;__main__&quot;:
    scale_val = 1.0
    set_scale_nodes_selected_objects(scale_val)