Python: 3.8.6
OS: Windows
IDE: PyCharm
I have 2 files: X.py and Y.py that are in different directories from each other.
X is mapped in source control while Y is not. Y contains the statement import X
.
This works fine when X and Y are in the same directory. If they are not, then on hovering above the import X
statement, PyCharm says 'No module named X'.
Following this SO answer, I added sys.path.insert(1, 'path/to/folder/containing/X')
above import X
but still get the error.
How can I ensure that X is visible to Y.py?
Note: The reason I am doing this and not following the typical package structure is because I do not want to move X out of source control or Y into source control.