I have following struct of the folder for my python code and I am using Python3.
python_lib/
model_driver/
__init__.py
globals.py
sb_driver.py
test_driver.py
In test_driver.py, I have imported the modules as it is give below
from .sb_driver import*
from .globals import *
When I import sb_friver.py in test_driver.py then I have following error comes up.
ModuleNotFoundError: No module named '__main__.sb_driver'; '__main__'is not a package
I have even tried without '.' in front of module.But I have had no luck.
Run the module from inside the model_driver folder using the -m switch
Using the -m switch
model_driver
will be registered as a package and relative imports will work. Using the m switch and running from the parent folder of the package is the correct way of running your srcipts - for details see here