I’m back again. I have created a small bot with pyautogui that controls a maximized window in a Headless Virtualbox VM, it works as intended. But if I clone the VM or uses on of its snapshots, It cant find the UI? It makes no sense to me. The only thing that works, is if I start it without headless and have my mouse courser in the cloned VM window or clicking a random spot inside the window. Afterwards it continues as normal, the problem is that its not headless anymore and that I’m running 3 VMs which would overlap each other, making 2 of them useless, since I cant click on it. The cloned VMs are running on both Windows and Linux.
This question is not yet answered, be the first one who answer using the comment. Later the confirmed answer will be published as the solution.