I want to send a command to the background window with python, but this command should be as if I were manually pressing the 1 key on the keyboard. I use win32api.keybd_event(key_code, win32api.MapVirtualKey(key_code, 0), 0, 0) for this, but it does not work in the background window. If I activate the window, it works.
I tried commands like pynput, sendMessage, postMessage but they do not respond.
1