I want to copy the world positions of a first bone to a second bone then save the second bones position as a keyframe(when the first bone has a keyframe) to retroactively fix rigging errors with roll on ik bones.

I can't sample the fcurves as they are local space so instead want to iterate the actions and set the frame then grab the matrix to apply and keyframe the second bone but can't find the command to set the action.


1 Answer 1


All actions in the file are saved in bpy.data.actions

for a in bpy.data.actions:

The action associated directly with your object, the one I'd call "in the slot"

action = object.animation_data.action

To set it to another action named "anotheraction"

object.animation_data.action = bpy.data.actions.get("anotheraction")

If there is no action named anotheraction it will set it to None. If there is no animation data on the object you will need to call



Note: can also have actions on any strip in the strips collection of an nla track in the animation_data.nla_tracks collection of your object.

  • 1
    $\begingroup$ Another hint for whoever is trying to set this at the armature: you set it actually at the object, not the armature. $\endgroup$
    – jsbueno
    Apr 6, 2018 at 20:07

You must log in to answer this question.

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