Bpy.ops.sequencer.scene_strip_add(): No way to make it work

Hi there!

I’m making a tool to add new scene strips automatically to the sequencer, but it seems impossible to get the command to work.

If I add a new scene strip by hand I get this command in the scripting info console:
bpy.ops.sequencer.scene_strip_add(frame_start=83, channel=2, scene=‘Panel.000’)

But if I write the same command in the Console or in a Python script it doesn’t work. It returns ‘Failed, context is incorrect’ error.

----------------------------------------------------------------------------------------------------------------------------

EDIT: Ok, I just realized the problem is the same with the rest of the strip_add commands. If I add a movie clip, an audio clip, an image or anything as a strip through the menus, then I copy the command from the scripting info, and paste it to the console to execute it, it throws the same ‘Failed, context is incorrect’ error.

Any idea of what’s wrong?

Scene strips cannot reference there own scene. Maybe this is the issue?

I’m afraid this is not the case. The video editing scene is different than the one I try to include as strip. In fact, doing it by hand through the menus works fine. It’s the python command what fails.

You got to make sure that the right area has focus(that command can only be executed when the mouse cursor is in the sequencer area): https://blender.stackexchange.com/questions/69114/how-do-i-get-the-correct-context-for-python-operators/69144#69144

Alternatively a poll can be added to a class to make sure that the operator is only run in the sequencer:

@classmethod
def poll(cls, context):
    if context.scene and context.scene.sequence_editor: