def search_pic(name_pic):
p_tf3 = False
while (p_tf3 == False):
print("!")
if pyautogui.locateOnScreen(name_pic, confidence=0.95) is not None:
print("найдена картинка")
x1, y1 = pyautogui.locateCenterOnScreen(name_pic)
pyautogui.moveTo(x1, y1, 2)
pyautogui.click(x1, y1)
p_tf3 = True