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?
yes, add it to your PYTHONPATH as you are doing, but you cannot invoke it with python foo.py, instead, use python -m foo.
Python-specific PATH environment variable?