PATH variable defines the directories which are searched when executing commands. However when you execute python sleep_plotter.py 113testCtM113.txt, sleep_plotter.py is an argument to the python program (command). Shell uses PATH to find python, but not its arguments.

You can add an executable attribute to your script:

$ chmod +x /Users/myname/python_functions/bin/sleep_plotter.py

Add a shebang sequence to the top (first line) of your Python script:

#!/usr/bin/env python

And run the script directly as a command:

$ sleep_plotter.py 113testCtM113.txt
Answer from Paula Munoz on Stack Exchange
🌐
AskPython
askpython.com › python › built-in-methods › pythonpath-in-shell
How to Get the Pythonpath in Shell? - AskPython
3 weeks ago - Importing a module makes Python look through a list of folders to find it. PYTHONPATH is an environment variable, a setting your shell passes to programs, that adds extra folders to that list when Python starts.
🌐
Ask Ubuntu
askubuntu.com › questions › 941919 › which-python-and-echo-pythonpath-give-different-directories-what-does-this
16.04 - 'which python' and 'echo PYTHONPATH' give different directories, what does this mean? - Ask Ubuntu
August 1, 2017 - The $PYTHONPATH variable just specifies additional locations from which you can import modules. It has nothing to do with the location of the Python interpreter executable that you get as output from which python.
Discussions

scripting - echo $PATH shows path to python scripts, but they cannot be executed - Unix & Linux Stack Exchange
I am new to using the shell, and wanted to create a directory in $HOME where I can put all my python scripts, set a path to that directory, so that I can go into any folder on my Mac and execute th... More on unix.stackexchange.com
🌐 unix.stackexchange.com
February 13, 2016
python - How to get the PYTHONPATH in shell? - Stack Overflow
debian@debian:~$ echo $PYTHONPATH /home/qiime/lib/: debian@debian:~$ python Python 2.7.3 (default, Jan 2 2013, 16:53:07) [GCC 4.7.2] on linux2 Type "help", "copyright", "credits" or "li... More on stackoverflow.com
🌐 stackoverflow.com
How do I find out my PYTHONPATH using Python? - Stack Overflow
How do I find out which directories are listed in my system’s PYTHONPATH variable, from within a Python script (or the interactive shell)? More on stackoverflow.com
🌐 stackoverflow.com
python - how to print contents of PYTHONPATH - Stack Overflow
Bring the best of human thought and AI automation together at your work. Explore Stack Internal ... Save this question. Show activity on this post. ... How can we print contents of PYTHONPATH variable. ... Obviously that means you don't have python path set in your machine. More on stackoverflow.com
🌐 stackoverflow.com
August 12, 2016
People also ask

How do I add PYTHONPATH inside a Python script?
Changing os.environ["PYTHONPATH"] changes the process environment and can affect child processes started afterwards. For an import in the running interpreter, add the intended directory to sys.path before importing, or install the package into that interpreter’s environment.
🌐
askpython.com
askpython.com › python › built-in-methods › pythonpath-in-shell
How to Get the Pythonpath in Shell? - AskPython
What is Pythonpath used for?
Pythonpath is an environment variable that is used to specify the location of Python libraries. It is typically used by developers to ensure that their code can find the required Python libraries when it is run.
🌐
simplilearn.com
simplilearn.com › home › resources › software development › understanding the python path environment variable in python
Understanding the Python Path Environment Variable in Python [Updated]
How do I create a Pythonpath variable?
To create a Pythonpath variable, you will need to first open the Command Prompt.  Once the Command Prompt is open, you will need to type in the following command: setx /M Pythonpath "C:\Python27\Lib".  And you should know that creating a Pythonpath environment variable in Python will be changing depending on your operating system and whether you want the variable to be permanent. On Windows, you can use the set command to create a Pythonpath variable:set Pythonpath=C:\python On Mac or Linux, you can use the export command to create a Pythonpath variable:export Pythonpath =/usr/local/lib/python
🌐
simplilearn.com
simplilearn.com › home › resources › software development › understanding the python path environment variable in python
Understanding the Python Path Environment Variable in Python [Updated]
🌐
GitHub
bic-berkeley.github.io › psych-214-fall-2016 › using_pythonpath.html
Using PYTHONPATH — Functional MRI methods
The PYTHONPATH variable has a value that is a string with a list of directories that Python should add to the sys.path directory list.
🌐
Simplilearn
simplilearn.com › home › resources › software development › understanding the python path environment variable in python
Understanding the Python Path Environment Variable in Python [Updated]
September 14, 2025 - Python path is an environment variable used to maintain directories of custom Python libraries. Learn how to set a python path variable on Windows and Mac now!
Address: 5851 Legacy Circle, 6th Floor, Plano, TX 75024 United States
🌐
Redreamality
redreamality.com › blog › pythonpathvs-code
How to Set PYTHONPATH on Windows, Linux, macOS and VS Code
August 21, 2025 - PYTHONPATH adds directories to Python’s module search path, sys.path. It does not select the Python executable: that is the job of your shell’s PATH or the interpreter selected in VS Code. For a project containing src/my_package/, add the src directory, not src/my_package or an individual .py file. Use an absolute path when the working directory may change. The following examples replace PYTHONPATH for the current shell session:
Find elsewhere
🌐
YouTube
youtube.com › watch
PYTHONPATH Explained, How to Use PYTHONPATH | How to Python 1 | Python Tutorials - YouTube
In this video we’ll be go over how to set up your PYTHONPATH in a linux terminal and windows command prompt to be able to use GitHub repositories you’ve clon...
Published: October 7, 2021
Views: 8K
🌐
Delft Stack
delftstack.com › home › howto › python › print pythonpath in python
How to Print Contents of PYTHONPATH in Python | Delft Stack
February 2, 2024 - The PYTHONPATH variable dictates the directories where Python searches for modules, significantly influencing the behavior of imports in a Python script or project.
🌐
Linux Mint Forums
forums.linuxmint.com › board index › main edition support › beginner questions
no $PYTHONPATH environment variable? - Linux Mint Forums
September 4, 2013 - ... I did as instructed and "echo $PYTHONPATH" still returns an empty string. This comment from that file might be helpful, but I don't understand it: ... # ~/.profile: executed by the command interpreter for login shells. # This file is not read by bash(1), if ~/.bash_profile or ~/.bash_login ...
🌐
PhoenixNAP
phoenixnap.com › home › kb › sysadmin › how to add python to path on windows, linux, and mac
How to Add Python to PATH on Windows, Linux, and Mac
December 12, 2025 - echo export PATH="[python-path]:$PATH" >> ~/.profile · For example, the following command permanently adds the /home/marko/.localpython/bin directory to PATH:
🌐
Real Python
realpython.com › add-python-to-path
How to Add Python to PATH – Real Python
July 23, 2026 - $ echo $PATH /usr/local/sbin:/usr/local/bin:/usr/sbin:/home/realpython/badpython:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games · Note that the $ symbol is used to tell the command line that the following identifier is a variable.
🌐
GitHub
gist.github.com › bngsudheer › 8b84b2e4dd5440333621e603104ccf6c
Print $PYTHONPATH · GitHub
Save bngsudheer/8b84b2e4dd5440333621e603104ccf6c to your computer and use it in GitHub Desktop. Download ZIP · Print $PYTHONPATH · Raw · print-python-path.py · This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below.
🌐
TutorialsPoint
tutorialspoint.com › How-to-set-python-environment-variable-PYTHONPATH-on-Windows
How to set Python environment variable PYTHONPATH on Linux?
May 2, 2023 - echo 'export PYTHONPATH=$PYTHONPATH:~/my_module' >> ~/.bashrc source ~/.bashrc · This appends the PYTHONPATH setting to .bashrc and reloads the configuration. After setting PYTHONPATH, verify your module can be imported ? import sys print("Python ...
🌐
docs.python.org
docs.python.org › 3 › using › windows.html
4. Using Python on Windows — Python 3.15.2 documentation
This document aims to give an overview of Windows-specific behaviour you should know about when using Python on Microsoft Windows. Unlike most Unix systems and services, Windows does not include a ...
🌐
LinuxQuestions.org
linuxquestions.org › questions › linux-newbie-8 › what-on-earth-is-$pythonpath-4175574196
[SOLVED] What on earth is $PYTHONPATH
March 7, 2016 - Sorry for all these questions guys... But I've been trying to make sense of this statement for several days. Add the module directory to your PYTHONPA
🌐
LinuxVox
linuxvox.com › blog › adding-to-pythonpath-with-bash-script
How to Add to PYTHONPATH with a Bash Script Without Hardcoding the Variable Value in .bashrc — linuxvox.com
Check echo $PYTHONPATH to confirm the path is correct. Ensure your module has an __init__.py file. While Python 3.3+ supports implicit namespace packages without __init__.py, regular packages still require it for most use cases.