I have written a very short python-function (using pyautogui) which entails the following:

Move the mouse to the taskbar and click on a certain location within that taskbar, this "reopens" a certain program. 
Then, within the opened program go to some location (moveTo...)

Now, I have noticed the following odd behavior: The first step always works, i.e. the specific program window is appears on the screen. However, depending on the specific program the second step either works or goes wrong. More specifically, I noticed that for notepad it works (i.e. the cursor moves to the specified location), whereas for a different program the mouse does not move at all.
Can anyone shed some light onto this behavior?
Thank you very much for your help!
it seems like the program is overwriting the script as a security method.
could you try and convert the code into exe file and run as an admin. this should overwrite the program.
pyautogui mouse click not working in certain programs