hwndMain = win32gui.FindWindow('Notepad', 'test - Notepad')
hwndChild = win32gui.GetWindow(hwndMain, win32con.GW_CHILD)
while True:
    temp = win32api.PostMessage(hwndChild, win32con.WM_CHAR, 68, 0)
print(temp)
Send some keys to inactive window with python