I'm writing voice control software for disabled people helpful in playing games. I don't know how to manage to hold keyboard keys and mouse buttons in Python, but working in games. So I could, for example, make voice command to move forward in meaning of holding W key. I can spam key presses, it works in some games but in most cases it doesn't. I have been trying different modules but none of seems to work in games. I know how to make button presses but holding keys doesn't work. Probably, I should use native Windows keyboard and mouse functions but I don't know where to start even. I will be glad for any help with the task and advices.
I have tried pynput, pyautogui, keyboard. They all let me press keys but not hold them.