Psychopy - Randomization and sequential question

PsychoPy version 2021.2.3
Hello I am a student and new using pschopy

I have a problem.
the experiment consists of presenting 27 stimuli (images) (3 levels easy, medium and very difficult) The levels are presented sequentially, but the stimuli of each level (9) are presented randomly (I can do this without problems)

My problem is that every 3 stimuli a question should appear, I can’t randomize the stimuli and that every 3 stimuli a question appears

(excuse my english, i’m not a native speaker)

If you have a routine that you want to show every three trials, you could put the following in Begin Routine.

if trials.thisN%3 != 2:
     continueRoutine = False 
2 Likes

thank you very much for your help. It was a very simple solution. But it motivates me to keep learning. Thanks a lot