# Multiple file browsers (different files) using python

I'm trying to find a way to bring up two file browsers (one after the other), but without success.

The reason for needing multiple file browsers is that I first need the user to export a text file, then export a mesh file. Those could have different names and be exported to different directories.

One solution I could think of is to have a separate operator that I call from the first operator, but the problem seems to be that 1. it doesn't return a value and 2. the code pause while I call the other operator.

I also tried to add multiple fileselect_add calls, but that seemed to crash blender. Any idea?

Sample code:

import bpy
from bpy_extras.io_utils import ExportHelper

class ExportCommon(bpy.types.Operator, ExportHelper):

bl_idname = "export.common"
bl_label = "Export common"
bl_options = {'PRESET'}

filename_ext = ".fbx"

def invoke(self, context, event):

return {'RUNNING_MODAL'}

def execute(self, context):

print(self.filename)
return {"FINISHED"}

• How about using an operator calling two file saving operator? – HikariTW Sep 6 '20 at 9:44
• I don't think that works as the second operator is dependent on the value of the first operator. And as I call the first operator the second operator will not wait for the result. – Simon Björk Sep 6 '20 at 12:57
• If you want to keep the result from the first operator, register a new properties group to scene and use that properties to save your result. Or you can also save at module namespace(maybe a good idea). – HikariTW Sep 6 '20 at 13:09

If I understand your question clearly, you want to proceed with the first modal result and run the second operator right?

Instead of calling two modal operator, you should call the second one in the first operator "execute" function. In that block, the modal part is done and can call another modal operator.

A simple snippet that run two file select window in a sequence:

import bpy
from bpy_extras.io_utils import ExportHelper

class ExportCommon(bpy.types.Operator, ExportHelper):

bl_idname = "export.common"
bl_label = "Export common"
filename: bpy.props.StringProperty()
filename_ext = ".fbx"

def invoke(self, context, event):