I have the following directory structure
Root/
Main.py
/Controller->
/MotorController->
MotorController.py
__init__.py
/Tools->
test.py
Now Tools/test.py have some test code that basically imports MotorController.py using relative path like the following
Tools/test.py from ..Controller.MotorController.MotorController import *
This gives an error that relative path cannot be used on non-package. Moving the test.py to the Root directory solves the problem but I really want my scripts to be in the Tools directory. How do I do this ?.
This is a related question; Say I make a package MotorController.MotorController.py like above that works on a particular robot. Now I want to have some calibration script that only works on that particular robot and hence I was planning to put that script in the same directory as MotorController.py. But it seems like one can't run a script from the same directory as the Package due to relative path and etc. Is there a way around or what is the general principle in such cases.