I try to share a value between two python scripts, I set the value at the first script with a singleton,but when i get the value at the second script, the default value (0) is returned .
Here are my files: the file that gets the value:
import mod #import the singleton class
...
def sendDistance(self):
print(mod.getDistance()) #get the value
The file that sets the value:
import mod #import the singleton class
...
mod.setDistance(35) #set the value with the singleton file mod.py
The singleton file:(mod.py)
import distance #import the file where value is stored
def setDistance(val): #set Value function
distance.x=val
def getDistance(): #get value function
return distance.x
And the file, where the value is stored:(distance.py)
x=0 #the default value that should be modified from mod
If I try to get the value at the file that sets the value (do a print(mod.getValue()) ), then the value is shown correctly. But at the getter side the value is always 0.