I am getting an error when I load the module in Python 3.6
.
spec = importlib.util.spec_from_file_location(load_module,path)
mod = importlib.util.module_from_spec(spec)
spec.loader.exec_module(mod)
I get the below error:
mod = importlib.util.module_from_spec(spec) File "<frozen importlib._bootstrap>",
line 568, in module_from_spec AttributeError: 'NoneType' object has no attribute 'loader'
How do I do it in the right way?
In the past, I have been using:
mod = importlib.import_module(load_module)
with the path of modules in the path. This works for python 3.7