I'm trying to figure out how to do things with Python in Blender and am struggling really hard to get even the most basic things done. The construction of the override-parameter in my script below is probably not ideal but seems to work.

The files-arg is of course nonsense. As I understand it I would need to construct a bpy.types.bpy_prop_collection of bpy.types.OperatorFileListElement. But I have no clue how to initialize either of them.

import bpy

screen = bpy.context.window.screen

area   = [area for area in screen.areas if area.type == 'SEQUENCE_EDITOR'][0]
region = [region for region in area.regions if region.type == 'WINDOW'][0]

override = {'window': bpy.context.window, 
            'screen': screen, 
            'area': area, 
            'region': region, 
            'scene': bpy.context.scene}

bpy.ops.sequencer.image_strip_add(override, channel=3, files=("test",))

2 Answers 2


It turns out that the problem is just the documentation (it's really misleading). Working code is:

                                  files=({'name': "test"},))

The information what other keys the dict could have is possibly hidden somewhere in the docs. I haven't found it yet.

It seems to be a general concept in the Blender scripting api to "fish in collections". E.g. to create the override arg. But also if you want a reference to the object you just inserted you seem to need to fish in a collection. But maybe I just don't get it yet. (I hope so)

  • 2
    $\begingroup$ I know this doesn't answer your question, but for a start I would recommend using the up-to-date api documentation, here: blender.org/documentation/blender_python_api $\endgroup$ Commented Apr 3, 2017 at 17:41
  • $\begingroup$ Don't use operators for this. See my answer for a better approach. $\endgroup$
    – dr. Sybren
    Commented Jun 10, 2018 at 9:29

Don't use operators to do this; they aren't intended to be called from Python.

The regular data/function API is much simpler to use:

import bpy

se = bpy.context.scene.sequence_editor_create()
seq = se.sequences.new_image('hey', 'C:/temp/hey.png', 1, 1)

You must log in to answer this question.

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