when adding a Value node through the geometry node tree editor I can enter #frame in the value field to have it synced up with the animation frame index (for procedural animation etc.)

enter image description here

However, I haven't found a way to add this kind of node with python. I was expecting to be able to do something like this:

modifier.node_group.nodes["Value"].outputs[0].default_value = "#frame"

But then I just get

TypeError: bpy_struct: item.attr = val: NodeSocketFloat.default_value expected a float type, not str

Is there any way to make use of this feature using only scripting?


1 Answer 1


Add a driver from nodes

import bpy

md = bpy.context.object.modifiers["GeometryNodes"]
dr = md.node_group.nodes["Value"].outputs[0].driver_add("default_value")
dr.driver.expression = "frame"
  • $\begingroup$ thanks! For some reason driver_add doesn't show up in node_group.nodes["Value"].outputs[0].__dir__() so I was unable to find it $\endgroup$
    – Linus
    Jun 26 at 8:18

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.