I think you want to have a bot that plays Dofus while the Dofus client is hidden/minimized (?)
As far as I know, yes, it is possible. I don't create bots using python but I think I can give you some questions/ideas so you can do some research.
1- I googled something like "pixel color search on hidden window with python" and I found some posts on stackoverflow, maybe you can read about it. https://stackoverflow.com/questions/60377832/get-pixel-color-from-window-in-background
2- Well we know it's possible to search colors on hidden windows, but can you interact with them? can you click on them? I googled it and yes, I found solutions on stack. The thing is, you can't use your primary mouse, but a secondary virtual mouse (so you can use the primary one for other tasks). Maybe this can help: https://stackoverflow.com/questions/56923061/creating-a-ghost-mouse-to-simulate-mouse-clicks
3- I dont know what happens when you simulate clicks on a hidden window. Will it become active? We dont want that. In case it happens, you should research how to keep a minimized windows always minimized.
Those previous 3 steps I think are key to solve your project. Investigate and if you are succesful do some tutorials on the forum! I think its an interesting project!