I am using pyautogui to detect a Button that shows up on Screen.
start_button = pyautogui.locateOnScreen('startButton.png, confidence=0.8)
it raises an exception if it's not found immediately, so if I want it to constantly check, I need to do this:
if pyautogui.locateOnScreen('startButton.png', confidence=0.8) != None:
print('HELLO WORLD')
except pyautogui.ImageNotFoundException:
pass```
How can I make it so the Variable example doesn't stop the code when the exception happens?
In context, I want to be able to do this:
``` if start_button != None:
print('HELLO WORLD')```