I have a while True loop that needs to be run in the background to update a variable and a function that needs to return that same variable. I tried this as a test:
import threading
downspeed = 0
def updating():
while True:
downspeed = downspeed+1
def main():
while True:
print(downspeed)
u = threading.Thread(name='background', target=updating)
m = threading.Thread(name='foreground', target=main)
u.start()
m.start()
But it only returns 0