I'm new to async funcs in Python, so excuse me if I look newbie at it.
I've got a program which runs inside an infinite loop for automating a task. I would like to know how could I make an async function that modifies a global variable when I press, for example, the K letter.
An example would be enough so I can complete the other tasks I have. I didn't try anything because I don't know how to start for async. Using Python 3.9.
Hope someone can answer so it can also help others, didn't find anything in my search.
Thanks in advance.
while True:
   ConsoleLog("NEWLINE", "")
   if(putHerosToWork == False and preventAFK == False):
       ConsoleLog("BLANK", "")
       CheckConnection()
   if(isClientConnected == True):
       CheckNewMapEvent()
       CheckTimeEvents()
       # Put Heros to Work
       if(putHerosToWork == True):
           doPutHerosToWork()
       # Prevent AFK
       if(preventAFK == True):
           doPreventAFK()
        
   time.sleep(10)
   cls()
 
    