I came accross a problem 2 days ago and I couldn't find a way to make it work, it's simple and my solution seems "good" to me. Here is what I got :
leftKeyCounter = 0
def sendCommand():
# I want to get the counter back to 0.
leftKeyCounter = 0
return leftKeyCounter
while True:
...
leftKeyCounter = leftKeyCounter + 1
The sendCommand() function is called automatically every 5 seconds with the "schedule" helper. In my terminal, the "leftKeyCounter" is not changed, for example; if it is 4, when the function is run, it tells me the variable is 0 now, but if i add one again, it's 5...
All the solutions I look for send me back to the "global variable" that has been deprecated, so I don't find a working solution...
Thanks for any help :)