Randomizing a Combination of visual and olfactory stimulation

OS (e.g. Win10):
PsychoPy version (e.g. 1.84.x): v2022.1.2
Standard Standalone? (y/n) If not then what?: yes
What are you trying to achieve?:

Hey everyone,

I am currently trying to build my first experiment in PsychoPy (also my first exp. ever), so I am very new to this.
During the fMRI Experiment, participants are presented with a combination of a visual and an olfactory stimulus, which they then rate on various scales. There are 10 different visual stimuli and 4 olfactory conditions, and each combination should be presented twice in total, in a random order.

I have to ensure that participants are not presented with the same picture twice/multiple times in a row, only with a varying olfactory condition (so picture 1 with odour a and then picture 1 with odour b, right after the other).

What did you try to make it work?:
In Builder, i created a loop which loops over the Routines for stimulus presentation and the subsequent ratings, using an excel file to specifiy the visual-odour combination for the next run (type: random, nr. repetitions 2). The file contains 2 colums, one specifying the image file and one the odour condition (which will have to be fed into some code for the computerized olfactometer later), and all rows to include every possible combination once.
With this i could ensure that a specific combination is not repeated directly, but only after all combinations have been presented once.

What specifically went wrong when you tried that?:
With this method I can not rule out, that the same picture might be chosen twice in a row with a different olfactory cue.
I would appreciate some help and thank you for your time and apologize, if I overlooked something!

This is the closes thing I can see to what you want to do that may help. I am not brilliant with the code components though, but this looks close enough.