demo_ref_globals2.py:
x = globals() print(x["__file__"])
C:\Users\My Name>python demo_globals2.py
demo_ref_globals2.py