I am very puzzled by this strange behavior. I have a file called test.py containing the following:
X={}
def fun():
global X
X = {'a':1,'b':2}
then I import the file as a module from the console and call the function
from test import *
fun()
I would expect X
to be updated but it is still an empty dictionary.
I am using
Python 3.8.2 (default, Jul 16 2020, 14:00:26)
is anybody able to reproduce this? Do you know why it happens?
Thanks.