:tocdepth: 3 :py:mod:`gws.lib.dynimport` =========================== .. py:module:: gws.lib.dynimport .. autoapi-nested-parse:: Handle dynamic imports **Source code:** :source:`gws.lib.dynimport` Package Contents ---------------- .. py:exception:: Error Bases: :py:obj:`gws.Error` Custom error class for import-related exceptions. .. py:function:: import_from_path(path: str, base_dir: str = gws.c.APP_DIR) Imports a module from a given file path. :param path: The relative or absolute path to the module file. :param base_dir: The base directory to resolve relative paths. Defaults to `gws.c.APP_DIR`. :returns: The imported module. :raises Error: If the module file is not found or a base directory cannot be located. .. py:function:: load_file(path: str) -> dict Load a python file and return its globals. .. py:function:: load_string(text: str, path='') -> dict Load a string as python code and return its globals.