As mentioned in the comments.
$PATH
in Linux is used to find a executable. In this case that's Python
.
After this executable is found, it will be executed "in" the current working directory and work from there.
Meaning when Python
gets the parameter one/toto.py
it will start looking from ./
after your folder and file.
You could create a wrapper script, place that under /usr/bin/mywrap.py
, mark it as a executable and utilize for path in sys.path:
and try to find your module and dynamically import it and do a "hand over" to it.
There is no magic in the Python
binary that will travers $PATH
since this is a shell variable used to find binaries in the operating system. Much like PATH
in windows is used for the same purpose.