I have created 3 python files in a folder. Here are each of the files and their contents:
one.py
products="testvar"
def oneFn():
global products
products=[1,2,3,4,5]
print("one Function")
two.py
import one
def twoFn():
one.products.append(100)
print(one.products)
print("two Function")
test.py
from one import *
from two import *
if __name__=="__main__":
oneFn()
twoFn()
print(products) # testvar
print(one.products) # [1,2,3,4,5,100]
Why is products and one.products returning different values?
import *is generally bad practice, be careful.