# Empty bpy.data.node_groups

I need to change the value of an RGB node programmatically. The data path of the node in question is bpy.data.node_groups["Compositing Nodetree"].nodes["RGB"], as can be seen in the screenshot attached.

However, if I enter that path into the Python console, no node groups are returned. I.e. bpy.data.node_groups.keys() is empty.

What is going on here? How can one access node groups?

You can access the compositing node tree via:

bpy.context.scene.node_tree


And your RGB node this way:

bpy.context.scene.node_tree.nodes['RGB']


As for why the tooltip shows a data path that you can't really access?
Don't really know, might be a bug.

• That did the trick, thank you! The data path displayed in blender is definitely wrong. – sebastian Oct 6 '15 at 15:46

I had the same issue with a different fix:

1. I created the material with <MATERIAL> = bpy.data.materials.new
2. Attached the material to the object with C.object.data.materials.append
3. Set <MATERIAL>.use_nodes = True

And the path suggested by Blender to edit, e.g., specular intensity was misleading: It suggested bpy.data.node_groups["Shader Nodetree"].nodes["Principled BSDF"].inputs[5].default_value but node_groupswas an empty collection.

I could access the value in the node tree with the following path:

<MATERIAL>.node_tree.nodes['Principled BSDF'].inputs[5].default_value = 0


Hope this helps someone!
Cheers,
Andres

• Certainly helped me. I've successfully used: mat = bpy.data.materials.new(name='orange') mat.use_nodes = True mat.node_tree.nodes["Principled BSDF"].inputs[0].default_value = (1.0,0.5,0.0,1.0) – edna May 11 '19 at 4:10
• Glad to hear that! the node system rocks – fr_andres May 11 '19 at 16:10