What is the correct expression to see a driver expression [driver.expression] for a material node with a driver originating from a datablock?

Newer Edit

enter image description here

Graph Window showing driver. Console inspection. Above.

enter image description here

Outliner window showing where the driver was added via the GUI. Above.

In the image above the UI shows that Sphere.008 has driver visible in the graph window and Python Console. I may have added the driver to this particular object or some other object which shares the same material. That action was not keenly audited. Why does a driver appear for a particular object when the material is being shared? This is really now a comprehension question about the [owner] of the driver.

Older Which has been addressed in the proposed answer below

Assume the following is valid Python and identifies what needs to be inspected


Both lines above identify a valid object but fail to reach animation data.


  • 1
    $\begingroup$ You should ask new questions not change existing questions. $\endgroup$
    – sambler
    May 24, 2016 at 6:51
  • $\begingroup$ how did you add this driver ? can you access it from other objects ? $\endgroup$
    – Chebhou
    May 24, 2016 at 8:52
  • $\begingroup$ @Chebhou Yes it works on other objects. It was added in the outliner data-block mode. I did not invent this. I will add another image from this question .. blender.stackexchange.com/questions/53154/… $\endgroup$ May 24, 2016 at 13:51

2 Answers 2


The animation data seems to be stored on the node_tree level there you can access the drivers collection and check the data_path to be sure you are in the right one then read the driver.expression:

  • $\begingroup$ Please see above edit and question. This is the answer. I just appended another related question. $\endgroup$ May 24, 2016 at 1:36

For your edited question, I can't be certain how you got the data path value that you show, but I expect you made a mistake in python or pasted the wrong thing into the console. I don't think you can achieve this through the GUI controls.

What you show in the graph editor isn't a material node driver, it is a custom property driver that has an odd data_path. Notice that a custom property is listed under Object->Drivers->property while a material node driver is listed under Object->Material->NodeTree->property so the value in your screenshot isn't attached to a material node socket, this is why you can find it in the objects animation data.

driver editor

So your Sphere.008 has a custom property with a bad driver. You can create a custom property in python with

bpy.data.objects['Cube']['something'] = 0

You can give it a driver with

new_driver = bpy.data.objects['Cube'].driver_add('["something"]')

Then you can alter the data_path with

new_driver.data_path = 'material_slots["Material"].material.node_tree.nodes["DataBlock"].outputs["Value"].default_value'

or maybe it was something like

obj.animation_data.drivers[0].data_path = 'bad path'

And then you have a custom value with an odd data path. Notice that the original property name doesn't match the name listed after changing the data path.

bad path matching question

The original property name may still exist as an object property or it may have been deleted, changing the data path has disconnected the driver from the original property.

The driver is controlling the node value specified in the data path, but as the object has the driver, not the material, the value node in the material isn't visually shown as having a driver.

If you had set the data path to something that doesn't resolve in python, then the property name would have a red underline showing the error.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.