State.import_extensions#

State.import_extensions(ext: Optional[Union[str, Iterable[str]]] = None, append=True) None#

Import one or more extension modules for use with this model.

This method isn’t really necessary for single-process model runs, as extension modules can be imported in the normal manner for python. The real reason this methid is here is to support multiprocessing. The names of extension modules imported with this method will be saved and passed through to subtask workers, which will also import the extensions and make them available as model steps within the workers.

Parameters:
extstr | Iterable[str]

Names of extension modules to import. They should be module or package names that can be imported from this state’s working directory. If they need to be imported from elsewhere, the name should be the relative path to the extension module from the working directory.

appendbool, default True

Extension names will be appended to the “imported_extensions” list in this State’s context (creating it if needed). Setting this argument to false will remove references to any existing extensions, before adding this new extension to the list.