I am trying to find a way to catch an event when user clicks on the video clip on the timeline in Sequencer and make it active. I basically want to run some custom code every time that happens.

I tried to use MSGBUS to capture that event, but it doesn't recognize the event. I was thinking of using Update function, but they seem to work only for custom properties.

Basically what would be the best way to catch when bpy.context.scene.sequence_editor.active_strip changes value? Or when bpy.context.active_sequence_strip changes value.

Thank you so much for any help or suggestions!



1 Answer 1


So I tried using a bpy.apps.handler on depsgraph_upgrade_post but evidently the depsgraph is not updated when an object is just made active.

So I went with making a custom property for the scene and then setting the active_strip.as_pointer() as a string property for the scene and then setting a time to check if this value has changed every .2 seconds.

Seems to work ok. Idk how likely it is to affect performance, probably not horrible but not the best case scenario either ¯_(ツ)_/¯ .

import bpy

class ActiveStripProps(bpy.types.PropertyGroup):
    active_strip_id: bpy.props.StringProperty()

def active_sequence_strip_change():
    active_strip = bpy.context.scene.sequence_editor.active_strip
    if active_strip is not None:
        active_strip_id = str(active_strip.as_pointer())
        props = bpy.context.scene.active_strip_props
        strip_id = props.active_strip_id
        if strip_id != active_strip_id:
            print("Active strip has changed.")
            props.active_strip_id = active_strip_id
    return 0.2

def register():
    bpy.types.Scene.active_strip_props = bpy.props.PointerProperty(type=ActiveStripProps)
    bpy.context.scene.active_strip_props.active_strip_id = "0"
def unregister():
    del bpy.types.Scene.active_strip_props

if __name__ == "__main__":
  • 1
    $\begingroup$ Ohhhh....that is very interesting! Thank you so much @Jakemoyo! I will give it a shot! $\endgroup$ Commented Aug 26, 2022 at 21:10
  • $\begingroup$ So I tried the code and I am running into a little issue, probably because I don't have enough knowledge about how app.timers work. Basically I tried to put my own function to run after print("Active strip has changed.") line of your code. What I noticed is that sometimes my function gets called, but sometimes it doesn't get called at all. Any suggestions how to make sure that my function would be called? Thanks in advance for any tips! $\endgroup$ Commented Sep 13, 2022 at 17:29
  • 1
    $\begingroup$ Ahhh...never mind, I realized that I run my script several times in the same blender session probably creating multiple app timers competing with each other. Restarting blender and running my code just once solved the problem! $\endgroup$ Commented Sep 13, 2022 at 17:37
  • $\begingroup$ Awesome, yeah there's also a method to remove timers as well. FYI. $\endgroup$
    – Jakemoyo
    Commented Sep 14, 2022 at 1:24

You must log in to answer this question.

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