import time
import pyautogui

def send_key(key):
    pyautogui.press(key)

# youll need to context switch to the application listening for the keys
send_key('1')
send_key('2')