# Modify nodes in compositing nodetree using Python

I want to setup basic node tree using Python operator and I cannot use compositor context. Hint over node values pointed to this data path:

bpy.data.node_groups["Compositing Nodetree"].nodes["Alpha Over"].premul


but this collection: bpy.data.node_groups includes only custom node groups.

This bug report: https://developer.blender.org/T35720 pointed me to right right data path. When you want to modify node tree in compositor, then you have to use following path:

bpy.data.scenes['Scene'].node_tree.nodes['Alpha Over'].premul


or you can use following syntax to avoid hard-coded name of scene (current scene will be used):

bpy.context.scene.node_tree.nodes.['Alpha Over'].premul


and it just works. :-)

• You can also use bpy.context.scene.node_tree.nodes to avoid hardcoding the name for the scene. – JakeD Sep 9 '16 at 14:58
• @pycoder you are right. Thanks for reminder. I will update answer. – JiriHnidek Sep 12 '16 at 7:45