Given the following structure in my python3 project:
.
├── utils
│ └── someutil
│ └── Stuff.py
└── tools
└── sometool
└── Main.py
Where the content of tools.sometool.Main.py
looks like this:
import XXX utils.someutil.Stuff XXX
Where XXX means "I am clueless please help me with this import statement". Further In the structure above I want to enter the commandline:
python3 tools/sometool/Main.py
and have it execute without failing on the import. What is the best and cleanest way to do this in Python 3?
I have experimented with putting __ini__.py
files with lots of statements like
sys.path.append(os.path.realpath(os.path.join(os.path.dirname(__file__), '../../')))
And the like. Is there really no better way?