Using mouse clicks to move on in a trial if the correct location is pressed

I am coding an experiment in PsychoPy using python. One component involves watching a circle move and then clicking the circle using the mouse. I only want the experiment to continue if the circle is correctly pressed. This is an adaptation of code I saw recommended in another thread, but it is not working. Right now I have it set to quit if it correctly registers the mouse click just for the purpose of development, but so far this has not been working. Thank you in advance for any advice you can give me!

for frameN in range(n_frames):
    for key in event.getKeys():
        if key in ['escape']:
            core.quit()
    if x < 750:
        x += 5
    circle.pos=[x,y]
    draw(circle)
    if mouse.isPressedIn(circle):
        print('Success')
        core.quit()

Not working how exactly? Can you share more of the code so we can see the definition of ‘mouse’ and ‘circle’?

Also is the “draw” you’re using here a custom function? Because normally that would be

circle.draw()
win.flip()