Please check the following picture which explains my questions.
In Linux, in Top Folder, if I run python Scripts/SC1.py, the error is:ModuleNotFoundError: No module named 'package1'
if I create a soft link in Top Folder using command: ln -s Scripts/SC1.py SC1.py, and then run command: python SC1.py, I still experience the same error.
I don’t want to mv SC1.py to Top Folder, how could I run it in Linux?
I created a soft link in Linux ln -s Scripts/SC1.py SC1.py, and open Top Folder in VSCode in Windows 10.
I could run the soft link SC.py in VSCode.
My question is:
how could vscode run soft link SC1.py in Top Folder but the soft link couldn’t be run in Linux terminal?
I am really not in a position to tell. There are three participants here: the OS, Python and VS Code. I wouldn’t even know where the culprit would be.
Wild guess
Probably in the terminal Python finds out where the file executing ( Scripts/SC1.py) is located and adds that folder to the path while VS Code adds the current directory to the path.
Option 1 and 2 that @frostming suggested seem both fine to me. Go with one of those.