Right now we export and import from, for example, scripts.set_laser. However, this assumes that b26_toolkit (or whatever toolkit) is in the python path. If it isn't, then the export and import functions won't be able to find any of the scripts. To fix this, we can change import_module to:
Right now we export and import from, for example, scripts.set_laser. However, this assumes that b26_toolkit (or whatever toolkit) is in the python path. If it isn't, then the export and import functions won't be able to find any of the scripts. To fix this, we can change import_module to:
import importlib.util spec = importlib.util.spec_from_file_location("module.name", "/path/to/file.py") foo = importlib.util.module_from_spec(spec) spec.loader.exec_module(foo)
This will allow importing based on the the absolute path.