I am currently making a minesweeper bot and when it detects that a game is done I would like it to restart the script and reset all the variables so it can restart completely the same as if I were to ctrl c then restart except inside of the script. (on a mac)
TLDR: completely restart script mid script
Example:
def restart(self):
if locateOnScreen('images/finish/gamefinish.png', grayscale = True) != None:
click('images/finish/gamefinish.png')
**CODE TO RESTART HERE**
else:
pass