Asking PsychoPy Not to Repeat Stimuli Across 3 Different Blocks

Hi all! I am currently assembling an online experiment that utilises three blocks - representing three conditions of stimuli - of trials, and I am having trouble trying to figure out how to randomly and evenly distribute my stimuli across these three blocks so that no one stimulus repeats in any block after being shown once.

I have 40 stimuli that I am looking to present in a random order across three conditions, labeled ‘dynamic’, ‘static’, and ‘control’. I am only presenting 13 of the images for each of the dynamic and static conditions, and the other 14 will be presented in the control condition. All stimuli contain versions of each condition, and I am trying to figure out how to ask PsychoPy to not repeat any of the images it has already shown in one condition for the other two. What makes it complicated is that while two of my conditions present the stimuli in a png format with image components, the third condition presents stimuli in an mp4 format with a movie component.

In order to address this issue, I have compiled all versions of every stimulus into one Excel file and tried to make a distinction between stimuli by assigning a specific ID to each image and by labeling each condition type as either ‘C’, ‘D’, or ‘S’. Having done this, I’m not sure how to incorporate these distinctions into my Python code. Is there some code that would ask PsychoPy to record a list of the IDs I’ve applied across all three blocks and not repeat any ID more than once?

To simplify: I need to ask Python to record a list of the IDs for each stimulus image as they appear in the large Excel file, and then not repeat any one value in that list across the three condition blocks. I am not super familiar with using Python code, so any and all help in applying a coding component to solve this issue would be greatly appreciated!! Thank you in advance!

What I do in this situation is have a single outer loop for all blocks, so that each row of the spreadsheet is only loaded once. Then I either have a routine which changes its behaviour every x trials, or separate routines which are designed so that only one of them will play on each iteration of the outer loop. This can either use continueRoutine = False or inner loops with nReps set to 0 or 1.