Consider I have a directory called root that has two directories: x and y. I have a module file that resides in x, let us call that test.py. Now in y, I have a module that needs to call test.py
I am doing a simple:
from x import test
And it works. I was wondering, how this works?
EDIT: How it works, as in there was no __init__.py file in x, but yet from y I was able to call a module from there.
It doesn’t. You, or your operating system, or your Python site startup scripts, have modified
PYTHONPATH.