Getting code segment to call values from conditions file

Hi there!

I have an experiment that makes use of a code segment to randomize and display pairs of image stimuli. For each trial, the code randomizes the sides of the screen that the images in each pair are displayed on, but it ensures that the image on the left side is displayed first, followed by the one on the right. Each image is displayed for five seconds.

Now, I would like to replace the images with video stimuli. The challenge is that the videos are of different lengths, so I cannot specify a fixed duration in the code. Instead, I have the length of each video listed in the conditions file for the loop. I was wondering if it would be possible for the code to call the duration values from the conditions file for each trial? For instance:

positions= [[-.5,0],[.5,0]]
shuffle (positions)
time = [None, None]
if positions[0][0] == -0.5:
time[0] = 0
time[1] = # pertinent ForestDuration value
elif positions[0][0] == 0.5:
time[0] = # pertinent SnowDuration value
time[1] = 0

Many thanks!

Image 2