I'm trying to animate the colour and strength properties of an emission shader based on external data using script. I add a cube and give it an emission shader. I can alter the strength property using:
bpy.context.active_object.active_material.node_tree.nodes['Emission'].inputs['Strength'].default_value=1
I then try to add a keyframe on the strength property using:
bpy.context.active_object.active_material.keyframe_insert(data_path="nodes[\"Emission\"].inputs[1].default_value",frame=10)
But I can't get the correct data_path. I must be missing something fundamental here. I have quite limited scripting experience in blender.
Code suggestions gratefully received.