that function is already called in the main loop
So, as I said, program execution is leaving the chunk of code you posted above. And, as I said, the solution is to define your variable as global or as local to the entire section of code in which it is used, not just part of it.