How can I force participants who have not passed the exercise to re-enter the exercise

OS (e.g. Win10): Win11
PsychoPy version (e.g. 1.84.x): 2023.2.2
What are you trying to achieve?:
If the participant’s practice accuracy is less than 80%, the participant is forced to move on to the next round of practice。
What did you try to make it work?:
I set a routine called practice_end. In this routine ,I set a code component。

I code in begin routine in this code:
if correctNumbers/(practice.thisN + 1) >= 0.80:
practice_again.finished = True
practice_end_text.setText(“pass practice,please press ‘press’ for formal experiment”)

I code in end routine in this code:
if practice_end_key_resp.keys == “space”:
practice_again.finished = True
practice_again.finished = False

What specifically went wrong when you tried that?:
I tried to practice, and the correct rate was less than 80%. The first practice popped up and asked me to press Q to enter the next practice, but I pressed “space” and directly entered the formal experiment