Jika keyboard.is_pressed

# keyboard module
# windows: pip install keyboard
# mac: pip3 install keyboard

import keyboard as k
if k.is_pressed("a"):
  # if the a key is pressed by the user
  print("You have pressed the key 'a'")
Colorful Capuchin