I would like to be able to run a Python script from any folder. However, this Python script, named statistics.py
calls upon two other files, colorbar.py
and language_bytes.py
. It also reads data from a folder that is located beneath it, in data/languages.yml
.
Because it has these dependencies, along with the .yml
file, I have been unable to have it be executable from anywhere. Even if I add #!/usr/bin/env python3
to the first line of statistics.py
and drag it, along with the other two files and the data
folder into usr/local/bin
, this doesn't work.
With a little bit of digging I found out that this was because the data
folder was being deleted as soon as it went into usr/local/bin
. This means that the Python script is unable to access the data that it needs, and so cannot be run.
Is there any other way to run a Python script globally?
Edit: Because this script is made to by modifiable by users and will be open-source, it would be optimal if it could be run without having to be bundled into a PyPI package. As well as this, it doesn't make sense that every time one would want to make a globally runnable script with resources they'd have to upload it to PyPI, even if it was just for personal use.