I\'m trying to get the name of the Python script that is currently running.
I have a script called foo.py and I\'d like to do something like this in ord
foo.py
The Above answers are good . But I found this method more efficient using above results. This results in actual script file name not a path.
import sys import os file_name = os.path.basename(sys.argv[0])