Change stimulus presentation based on element of conditions file

I am attempting to change the length of the required text entry, based on the the experimental condition defined in my conditions file. However, I can’t seem to figure out how to psychopy refers to the conditions file.

My loop is named trialLoop and my conditions file is named list2-exp1a.xlsx, and the column in my conditions file that I want to use is called primeImgPlaus

So I’m imagining that I can do something like the following in a Begin Routine code:

if trialLoop[primeImgPlaus] == "fill":
     string_length = 15
else:
      string_length = 10

However, I get the error “TypeError: ‘TrialHandler’ object is not subscriptable”, which is triggered by the code if trialLoop[primeImgPlaus] == "fill":. So I think there’s something about interacting with the TrialHandler I don’t understand.

Any help is appreciated!

Wow nevermind–I was overcomplicating. The code works if I just reference the name of the column in my conditions file directly. Not sure why that isn’t the first thing I tried!

if primeImgPlaus == "fill":
     string_length = 15
else:
      string_length = 10