Most bpy.ops
need a context override to be executed from the python console. In your case, you need to override the area
and region
so that the op will know to use the video sequence editor's window as its context.
Here is code that you can cut and paste into the console that will do that.
areasVSE = [area for area in bpy.context.window.screen.areas if area.type == 'SEQUENCE_EDITOR']
region = [region for region in areasVSE[0].regions if region.type == 'WINDOW']
override = {
'area' : areasVSE[0],
'region': region[0],
}
bpy.ops.sequencer.effect_strip_add(override, type='TEXT', frame_start=1, frame_end=26, channel=1)```
Note that this assumes that you have only one window open with the VSE. If you have more, it will pick the first one.
3.2 Update
Context overrides are deprecated in Blender 3.2 and are scheduled to be removed in Blender 3.3 The replacement is temp_override
. The manual has examples of how to use the new function.