I am writing a script where I want to automate the animation of Shapekeys. I tried to use the following command:

obj1.keyframe_insert(data_path = 'eval_time'), obj1 is the object containing the Shape Keys.

The command should add a keyframe to the "Evaluation Time" setting for the absoulte Shape-Key:

Insert Keyframe to Evaluation Time

'eval_time' is the data path I have copied via the command "Copy Data Path": Copy Data Path Command

However, I get the following message in the system console.

TypeError: bpy_struct.keyframe_insert() property "eval_time" not found

Using other data-paths like 'scale' or 'rotation_euler' works just fine, 'eval_time' fails, however.

Since this reference I seek to get is nested I have also tried the command using the full ID-path: obj1.keyframe_insert(data_path = "bpy.data.shape_keys['Key.002'].eval_time"), but that didn't work out either.

Can anybody help me out how I can add a keyframe to the "Evaluation Time" attribute using the python API?

Thank you very much in advance.


2 Answers 2


A single property

You were all round it. Similarly to pythons getattr(obj, property_name) the keyframe insert is after the object and a property of that object.

>>> obj = C.object
>>> obj.data.shape_keys

>>> obj.data.shape_keys.eval_time

>>> obj.data.shape_keys.keyframe_insert('eval_time')


Tip turn on the tooltips and developer extras in Edit > Preferences > Interface > Display to assist in finding datapaths.


actually you must see where is each property

the current API show that is a main property of all shapekeys

in this case:

bpy.context.active_object.data.shape_keys.keyframe_insert(data_path='eval_time', frame=1)

this is different for example of "value", that is a specific float in each keyblock

bpy.context.active_object.data.shape_keys.key_blocks['Key 1'].keyframe_insert(data_path='value', frame=1)

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .