I am working on a project based on Python 2.7 and I am trying to import a module which is in a package folder that contains __init__.py
and the file that I want to import called package1.py
, but I am unable to do so. This is my folder structure: main_project/Tools/common/package1.py
Note that my project files are in the folder main_project. So, I am trying to call the package1.py
by using an import
statement in my script:
from Tools.common.package1 import variable
But I am getting an ImportError: No module named Tools.common.package1
.
What is the solution to solving this error as I want to use the package feature for my project?