I'm running a pyautogui script to automate an app I have and the script uses both keyboard and mouse 
I want to be able to normally use my PC while the script is on (which needs the app to be in focus and control the mouse and keyboard) 
I'm wondering if there is a way to be able to make the script run in the background and make windows think the app is in focus and register all mouse clicks and keyboard input to that app 
I've tried to run the script in a VM but that was too slow, maybe there is a an app to make a virtual mouse or a virtual desktop I can use or something similar? 
any method is welcome, thanks
EDIT: Solution is pywin32
You can't do that in pyautogui I believe.
Try exploring pywinauto instead if you are automating on windows. That module takes control of a desktop application using windows win32.
Hope this helps :))
How to use pyautogui script in the background