I have a problem with the import file in the bash script.
My project directory looks like this:
project
├── folder1
│   └── file1.py
├── folder2
│   └── file2.py
├── data
│   └── example.txt
├── utils
│   ├── __init__.py
│   └── globals.py
└── run.sh
The globals.py file contains some config global variables that will be used in the whole project.
I want to write a bash file to run all .py files like this run.sh:
conda activate pyenv
# Step 1.1
python folder1/file1.py data/example.txt >> data/output_1_1.txt
#  Step 1.2
python folder2/file2.py data/output_1_1.txt >> data/output_1_2.txt
But then I got this error:
Traceback (most recent call last):
  File "folder2/file2.py", line 15, in <module>
    from utils import globals
ModuleNotFoundError: No module named 'utils'
This is my file2.py where I import utils.globals:
import sys
sys.path.append("../")  # Add "../" to utils folder path
from utils import globals
When I run each file individually, it works fine, but I don't know why it doesn't work when I run source run.sh.
