I have a python file script_00.py, where I import some module at the beginning:
from some_path import Core
However, based on the value of a variable, I might have to override this and load an alternative version of this module. This is the folder structure:
core_alternative_version_folder/
|____ core_custom.py -> Core
src/
|____ script_00.py
so, I want to import the implementation of core_custom as Core. I tried using (always in script_00.py):
if condition is True:
Core = importlib.import_module("Core", package="..core_alternative_version_folder.core_custom.py")
But I'm getting the error:
ModuleNotFoundError: No module named 'Core'