**OS** (e.g. Win10): 10

**PsychoPy version** (e.g. 1.84.x): 3.0.5

**Standard Standalone? (y/n)** : yes

**What are you trying to achieve?:**

I have an experiment with 4 different routines. Each routine is controlled by a different .csv file, and the order of routines is random. While the set-up I have now worked for our initial purpose, my supervisor has requested a slight change to the experiment that I cannot seem to implement.

Initially, there were 4 routines. Each routine would be randomly selected, and then run 2 times before moving to the next one. Here’s what I did to make this work: First I put an **outer loop** around the entire experiment. This loop has 1 repetition, has loopType random, and the condition file looks like this:

```
Routine 1 Routine 2 Routine 3 Routine 4
2 0 0 0
0 2 0 0
0 0 2 0
0 0 0 2
```

Each separate routine has it’s own **inner loop** as well, which is set to random, and has $nReps set to a specific routine as listed above (so the first routine would have $nReps: Routine 1, the second routine would have $nReps: Routine 2, and so on).

There is then a final trial specific loop around the part of each routine with the trial structure. This loop is set to random, has $nRep of 1, and draws from the specific condition file associated with it.

This setup works well for what we wanted. It randomly selects 1 of the 4 routines, runs the routine 2 times, and then randomly selects the next routine and continues until the end.

However, we have changed the experiment slightly. When each routine runs, we now have 10 different condition files with a pre-specified order of stimuli. The routine therefore needs to run through the .csv condition file sequentially. While this is easy enough to do, we also want the routine to randomly select 1 of the 10 .csv condition files, run through it sequentially, randomly select one of the other .csv condition files, run through it sequentially as well, and then move on to the next routine and repeat this procedure.

I am including an image of the structure of the experiment in case that helps.

To make things a bit more clear with the image, the Outerloop controls randomization of the innerloops. There are 4 innerloops, each controlling the flow of 1 of the 4 routines (innerloop_3 is displayed in the image). During each routine, participants read the Instructions, wait 5 seconds, and then run through each trail of the routine (governed by the OlfactoryStimuliLoop in the image for example). They wait, and then run through this a second time before randomly moving to the next routine. I want the .csv file used as the condition file for the OlfactoryStimuliLoop to be randomly chosen from 1 of 10 .csv files. When the Routine loops around a second time, a different .csv file would be chosen for the OlfactoryStimuliLoop condition file.

Thank you,

Stephen