How to unlink datablock in Action Editor

Using a python script in blender, is it possible to unlink the current datablock in the Action Editor. Basically I want to press the X next to the name of the action. As far as I can tell, there is no python command attached to that button.

Hi sabby

the action in the action editor is the one attached to the context object.


import bpy

context = bpy.context
object = context.object

#should put checks in to see if you have object animation_data etc

action = object.animation_data.action  # this is the action that is shown in action editor.

# the action can be unlinked using.

object.animation_data.action = None


Thanks, it worked!