I have script1.py, which containes a function with two variables, variable1 and variable2. The value of these variables get updated every x seconds. If script1.py is run as the main script, it has an endless loop to update variable1 and variable2. The function itself however does not have that endless loop.
Instead, I want to import that function into script2.py and run there with an endless loop. Since the values of variable1 and variable2 are updated continiously, I need to get these new values somehow into script2.py . I tried to do that by
while True:
import upload
time.sleep(10)
but python checks if the module has already been imported and, if yes, won´t import it again. How can I get the updated variables from script1.py into script2.py every x seconds?
Thanks in advance!