I am trying to figure out how to programmatically execute a module that contains relative imports.
psuedo code
spec = importlib.util.spec_from_file_location(name, path)
mod = importlib.util.module_from_spec(spec)
spec.loader.exec_module(mod)
Where name is the class, and path is the absolute path to the .py
When the module that is being loaded contains relative imports, the call to the exec_module throws the following exception:
attempted relative import with no known parent package
Is there a way to programmatically execute a python module that itself contains relative imports? If so, how?