I know there're tons of questions about relative import in python, but none of them work with my script.
Here's my project directory tree:
project\
Enums\
Candle.py
Trader\
Trader.py
As I run this command:
python Trader\Trader.py
And here's how I import a class from Enums in Trader.py:
from Enums.CandleColor import CandleColor
I get this error:
Traceback (most recent call last):
File "C:\Users\user\Desktop\Proj\Test\Trader\Trader.py", line 6, in <module>
from Strategy import Strategy
File "C:\Users\user\Desktop\Proj\Test\Trader\Strategy.py", line 2, in <module>
from Enums.CandleColor import CandleColor
I tried different ways of fixing this including adding the parent directory to sys.path, using .. while importing, etc. but none of them didn't work.
As I run this project in PyCharm, it works just fine but from a command prompt, I get these errors.