<s>[INST] Get the name of current script with Python I'm trying to get the name of the Python script that is currently running.
For example, I have a script called foo.py and I would like to do something like this inside it:
print Scriptname

and get: foo.py.
 [/INST] Use __file__.  If you want to omit the directory part (which might be present), you can use import os,os.path.basename(__file__).
 </s>