import_file

file_system.import_file(multiple_selection: bool = False, file_extension: tuple[str] | list[str] | str = None, mime_type: tuple[str] | list[str] | str = None, type_identifier: tuple[str] | list[str] | str = None) → list[str] | str

Opens the file picker to import one or more files. Returns the file path of all the selected files as a list if ‘multiple_selection’ is ‘True’ or a string if it’s ‘False’. Raises FilePickerCancellation if no file is selected.

If no file type was specified, the file picker will allow the selection of any file type.

Parameters:
  • multiple_selection – A boolean indicating whether multiple selection is allowed.

  • file_extension – A string or a list of allowed file extensions.

  • mime_type – A string or a list of allowed mime types.

  • type_identifier – A string or a list of allowed Uniform Type Identifiers (UTI).

Return type:

list[str] | str