in the code below when function delta is imported from main.py values of d1and v1are not being imported properly but when i paste the function delta in the same file as function t values are imported correctly. why does this happen ? what can i do to get proper values when imported from different file?
# stuff.py
from env import v1,d1
def delta ():
global d1,v1
gas = d1 + v1
print (gas)
#sus.py
from env import d1,v1,idd,m
from main import delta
def t():
global two
global d1,v1,idd,m
two = two -1
if m ==0:
if idd ==1 :
d1 = 2
idd = 0
elif idd ==0:
v1 =2
delta()
idd =2
i did try adding print statements to check value of d1 and v1 inside delta and the value is 0 .
and as i have mentioned above the error is fixed if i place function delta in same file as functiont