As the title says, I would like to know a way to detect if a window exists using python. I'm using this so I can close a window if a text file has 1 or more instances of a string. I know how to do the part to detect the string, and how to close the window (although if there is a better way to close a window without killing the process, other than ahk and pyautogui.press() than I would love to know) but I can't figure out how to detect if the window exists. For clarification, I want to detect the window, not the process, as the app being closed runs in the background as well.
Im rather bad at explaining things so if there is anything I need to explain please just ask.
One last thing, I'm using python 3.x