You have to refactor your whole approach, it will not work this way.
Of course, this does not work because there is a fundamental misunderstanding about how Streamlit works:
Besides the main problem below, pywin32 wil not work at all, because it is a windows only library and streamlit cloud is a linux debian based environment.
But the main problem is:
Streamlit consists of a frontend and backend part aka Client and Server. Any interaction with streamlit must be done via the browser or browser APIs. Anything trying to bypass this, may work on your local computer, but will fail as soon as streamlit is hosted, i.e. streamlit no longer runs on the same computer as the browser. Itβs just a lucky coincidence that this works on the local computer, because the client and server are identical in this case.
But what happens on Streamlit Cloud when you try to open pyautogui (or other) gui widgets or try to access hardware? They will be opened on the computer on which the python application is running. But there is neither an UI nor a graphics driver nor a mouse device on streamlit cloud (aka Server) and even if there was, it would be the wrong computer.
You need a Streamlit component that can read mouse coordinates. I donβt know if this already exists.