I have a python script that refers to a module from its ROOT directory. The directory has the following structure:
tensorflow_2
Mask_RCNN
mrcnn
model.py
samples
balloon
balloon.py
The code goes as follows
import os
ROO_DIR = os.path.abspath("../../")
print(ROOT_DIR)
/home/mypc/tensorflow_2/Mask_RCNN
from mrcnn.model import log
from samples.balloon import balloon
The first of the imports stated above can be run without issue. The second won't run. It can be sovled by copying the balloon.py to the ROOT directory and just stating:
import balloon
However, this is not a fix in my eyes, just mediation of the problem. I already tried calling:
export PYTHONPATH="$PYTHONPATH:~/mypc/tensorflow/Mask_RCNN"
to add the ROOT directory to my pythonpath.
log is a function in model.py.
can someone explain to my why it is possible to import a function but not the balloon.py file.
I have not written the code, btw. I am running python 2.7 due to ROS limitations. Running the same script in a python3 virtualenv gave the same result.