import keyboard
import time
import pydirectinput
while True:
time.sleep(0.1)
if keyboard.is_pressed('x'):
pydirectinput.click(button='right')
time.sleep(0.2)
pydirectinput.click(button='left')
time.sleep(0.2)
print('ok')