I am playing a game and in order to make things easier, I have a basic python script that repeatedly presses 'z'.
import pydirectinput
import time
time.sleep(3)
while True:
pydirectinput.press('z')
I believe that due to directx issues, only pydirecinput library works and other libraries can not imitate pressing 'z' on the game. So, I have to use pydirectinput.
Here is the problem: When I use the script, I can not change the window since the code repeatedly presses 'z'.
How can I make the script that presses 'z' in the background even though the game is in background and open new windows?