import keyboard # using module keyboard if keyboard.is_pressed('e'): # if key 'e' is pressed print("you're holding the E key!")