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