How to change the current action on dope sheet editor with script? I am trying to load multiple animations, I use dope sheet editor to manage the animations. I have a couple of matrices, what I want to use bone by bone, then insert keyframe one by one. My problem is that I found no way to select the actual animation I would like to set the keyframe.

I am pretty tired of googling since I found only outdated 2.5x stuff.

So my question is: how to change current action on dope sheet with script?
For me this just worked fine:

#reguirement: you got action called "Idle"
csontvaz_objektumkent = bpy.data.objects[0] #this is actually the armature, but I use index
                                            #because I am lazy
bpy.context.scene.objects.active = csontvaz_objektumkent
csontvaz_objektumkent.animation_data_create()
csontvaz_objektumkent.animation_data.action = bpy.data.actions["Idle"]


I am sorry if it looks bad: I am pretty new to BPY.