0

I'm new to scripting in Blender 2.91.0 and I'm trying to modify nodes via code. According to the API I should be able to access my current node selection via the Node Context.

My material is using nodes and I can access them like this:

bpy.data.materials[0].node_tree.nodes["Image Texture"]

However, for some reason, I am not able to access the node context at all. Neither bpy.context.selected_nodes nor bpy.context.active_node seem to exist, so I can't get the current node selection. Contradicting the documentation my Python console autocompletion doesn't show them as valid options (see image).

Screenshot of Python console autocompletion. active_node is not available.

Note: Executing bpy.context.active_node anyway returns the error 'Context' object has no attribute 'active_node'

Does anyone have an idea what I am missing? Any help is appreciated.

0 Answers0