I have been instructed to create a universal algorithm in Blender that prompts the user for file selection from a dialog box, takes those images (given they are the acceptable formats), add them to a single image strip, and render the new animation.

I have successfully created a dialog box that allows me to select the files I need but I am unable to figure out how to use these selections to create an image strip. I have tried the solution here How can i open a file select dialog via python to add an image sequence into VSE? but it is from an older version of Blender and complexes my code more than necessary. I also found the Blender Docs on how to open a file dialog box but it was the same as what I had come up with.

I asked a more general version of the question here

Using Python to prompt a user for file selection from a dialog box and append to image strip in VSE

but what I really need help with is using this selection of individual frames, which must be of a usable image format, and turning them into an image strip by stringing them together consecutively.

  • $\begingroup$ Please clarify your specific problem or provide additional details to highlight exactly what you need. As it's currently written, it's hard to tell exactly what you're asking. $\endgroup$
    – Community Bot
    Commented Jun 27, 2022 at 20:08
  • $\begingroup$ Just updated my question, hope that's more clear! $\endgroup$
    – se2000
    Commented Jun 27, 2022 at 20:30
  • $\begingroup$ Hello and welcome. Please don't post the same question more than once. If your previous question was put on hold, address raised the issues by editing it so it can be reopened rather than post a new one, otherwise see What should I do if no one answers my question? $\endgroup$ Commented Jun 28, 2022 at 9:52
  • $\begingroup$ Another user asked me to rewrite the question to specify which part of my pipeline I needed help with. I am new to stack exchange so I did not know I could edit questions before I posted a new one. $\endgroup$
    – se2000
    Commented Jun 28, 2022 at 16:05

1 Answer 1


This answer explains in general how to use a dialog box. In it, there is an execute function:

    def execute(self, context):
        directory_path = Path(self.filepath).parent
        for file in self.files:
        return {'FINISHED'}

Notice that I changed a couple of lines. You have to figure out what to replace the comments with.

The key is to find out how Blender adds images to a strip, and then to modify that execute function to do that.

To solve the first part, bring up Blender, switch to the Scripting workspace, and change the 3D Viewport window to the Video sequence editor (VSE).

In the VSE manually run the command to add images to a strip ShiftA and select Image/Sequence from the menu. Fill in the dialog box and make sure the result is what you want.

Blender will have written something in Info window at the bottom of the display. Here's mine, but with some data missing:

files=[{"name":FILE1, "name": FILE1}, {one entry for each file I selected}], relative_path=True, show_multiview=False, frame_start=1, frame_end=26, channel=1, fit_method='FIT')

Now you can look up bpy.ops.sequencer.image_strip_add in the manual and find the exact arguments you need. The key bit is that you have to convert the filenames in self.files into a dictionary. So now you can change #DO SOMETHING WITH THE FILENAME into code to do that. Let's say you call the result file_list.

The final step is to replace #CALL SOME FUNCTION with a call to image_strip_add() filling in the arguments.

NOTE: This answer assumes you're doing this in an operator that is invoked in the context of the VSE. If you invoke your operator in a different context, then you will have to override that context. If you need that I can find some other answers that demonstrate how, taking into account that overriding context changes in Blender 3.2

  • $\begingroup$ If my understanding is correct (which it may not be) I just need to run bpy.ops.workspace.append_activate(idname="Video Editing") bpy.context.area.type = 'SEQUENCE_EDITOR' to activate that, right? Or is there a better way to go about it? $\endgroup$
    – se2000
    Commented Jun 29, 2022 at 17:25
  • $\begingroup$ My class has to have OT as well, correct? Thank you for all the help by the way, I appreciate you taking out time to explain this clearly to me it has helped so much! $\endgroup$
    – se2000
    Commented Jun 29, 2022 at 18:33
  • 1
    $\begingroup$ Yes, your class needs the OT. It's part of a naming convention introduced in Blender 2.80. Operators need OT, menus need MT and panels need MT. The full format is prefix_OT_suffix and the underscore characters are required. $\endgroup$ Commented Jul 1, 2022 at 0:36
  • $\begingroup$ You need to have a SEQUENCE_EDITOR window open. There is a video sequencer workspace, although it's not in the default set of workspaces. You could use it. You could use a window manager command to switch an existing area, say the 3d Viewport to the VSE, or you insert a new window in an existing workspace. That's what you seem to be trying to do in your comment, but I've never tried it myself. $\endgroup$ Commented Jul 1, 2022 at 0:39

You must log in to answer this question.

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