Issue with repeating second stimulus before or after rest

Hello everyone,

I hope this message finds you well. I’m encountering an issue in my experiment using Psychopy version v2023.1.3, and I’m seeking some guidance to resolve it.

The experiment involves evaluating the semantic coherence of word pairs. The procedure consists of presenting an instructional prompt, followed by a fixation cross, then the first word, a blank screen, and finally the second word. Participants are required to press a key after seeing the second word in order to proceed. There are a total of 320 trials. 4 blocks, one rest between 2 blocks.
the code of rest(begin rutine) is below:
if (blocks. thisN+1) % 2!=0:
continueRoutine= False

After dozens of trials, I’ve noticed that the first word is presented normally, but the second word keeps repeating the same word in every trial. Interestingly, with each program run, the repeated second word changes, but it remains the same throughout the experiment run.

I’m open to any insights or experiences you might have regarding similar situations. If you require more details about the experiment setup or code snippets, please let me know.

Thank you in advance for your help and support.