Run
x = 10 def my_function(): x = 20 print("x [local value] :", locals()['x']) # Print value in global x print("x [global value] :", globals()['x']) my_function()
Output