I'm writing an import plugin for blender 2.8x and I'd like to make use of the multiple file selection feature. Unfortunately, I can't find any provision for this in 'ImportHelper' (the class I derive from) and web searches haven't yielded anything that seems to work and I can't seem to find anything in the documentation either.


1 Answer 1



It turns out there are several things you need to do to make this work, it's not yet covered in the documentation.

First of all, it helps to know what the base class 'ImportHelper' does when using it in an import script. On initialisation, the script calls 'context.window_manager.fileselect_add(self)' which adds several objects to your class. This string in the source code gave it away:

"The string properties 'filepath', 'filename', 'directory' and a 'files' " "collection are assigned when present in the operator"

The 'files' object is what we need but that's only present in if you also have the correct property present in your class, for example:

files: CollectionProperty(
            options={'HIDDEN', 'SKIP_SAVE'},

then, if that is present, you can access this in your class's 'execute' method to iterate through all the files in your selection:

for meshfile in self.files:
            filepath = meshfile.name

Also, remember to include the correct properties, I include these in my importer:

from bpy.props import (
  • $\begingroup$ Thanks @Luther, most helpful. io_import_images_as_planes.py has a working example of this. $\endgroup$
    – Ron Jensen
    Aug 7, 2020 at 15:24
  • $\begingroup$ Thank you for this @Luther. How would I go if I'd like to select a FOLDER, instead a file or a set of files? Is this possible? $\endgroup$
    – Sergio
    Sep 26, 2022 at 11:02
  • $\begingroup$ @Sergio - I'd use the python module 'glob' for that, $\endgroup$
    – Luther
    Oct 26, 2022 at 12:22

You must log in to answer this question.

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