Repeat incorrect trials after completing all block trials

What are you trying to achieve?: I am trying to repeat the incorrect responses after all the trials within a block are completed.

What did you try to make it work?: I managed to repeat the incorrectly responded trials right away but not at the end. I have a nested loop: the outer loop - block, inner loop - trials.

End Routine:
if key_resp.corr:
ifLoop.finished = True

What should I add in my code to start the ifLoop trials only if the trials of the block are completed?

Thank you in advance!!

If you want to repeat them later then you should append incorrect trials to a list that you can use for a second loop