Say I have a script script.py located in a specific folder in my system. This folder is not available on PATH.
Assuming that I will always run script.py using python script.py, is there any way to run my script from anywhere on the system without having to modify PATH?
I thought modifying PYTHONPATH would do it, but it doesn't. PYTHONPATH seems to only affect the module search path, and not the script search path. Is my understanding correct?
PYTHONPATHdoes not affect script search path. You can create an env varMY_SCRIPT=/full/path/to/script.pyand then runpython "$MY_SCRIPT"wherever you want.