Modifying BART to have different colored balloons with separate banks

I am making a modified version of the BART demo here: demos / The Balloon Analogue Risk Task · GitLab
For coding components I’m using Python, which I have very little experience with.

Basically, I am trying to see if coffee users will take more risks for a caffeine related reward (Starbucks or Dunks gift card) compared to a control award (gift card for similarly rated restaurant that doesn’t sell coffee). The idea is to have two different colored balloons presented in a semi-random order, with separate banks that will be presented on the screen. At the end, they will be sent a gift card for the reward with the highest earnings. (I previously got this whole thing almost-functional by copy/pasting the ‘trials’ loop components and making a new loop with a big loop going around it all. I realize now this was not the best way to do this and I restarted from scratch.)

To do this, I have summoned a second balloon by adding the image to the ‘trialTypes’ excel sheet under ‘imageFile’ and changing the image stimulus to $imageFile. The data file I’m getting at the end is almost exactly what I need (nPumps, and I’m planning on recording reaction time too but haven’t gotten there yet). What I’m struggling with now is creating two separate ‘banks’ for each of the balloons for the participant view.

What I’m currently playing with is copy/pasting variables from the code component and adding ‘caff_’ or ‘cont_’ in front, like below. I thought if I did this and then ask it to refer to the sheet based off of the image that’s being shown, it would create separate banks.

updateEarnings Begin Routine:

#current balloon
thisBalloonEarnings=0.0

#input file
in_file = 'trialTypes.xlsx'

#caff balloon
if imageFile=='images/redBalloon':
    caff_bankedEarnings=0.0  #starbucks
    caff_balloonEarnings = ''
    caff_bankedText = '' #starbucks
    caff_lastBalloonEarnings=0.0
 
#cont balloon
if imageFile=='images/blueBalloon':
    cont_bankedEarnings=0.0  #subway
    cont_balloonEarnings = ''
    cont_bankedText = ''
    cont_lastBalloonEarnings=0.0

And this is the error message I get

File "C:\PSYCHOPY\bart-demo\bart_2.6_lastrun.py", line 120, in <module>
    if imageFile=='images/redBalloon':
NameError: name 'imageFile' is not defined

Is there a simple issue with the way I’m asking it to refer to the sheet? I’m seeing a lot of people mentioning Pandas but I’m nervous about things getting messed up when I post the study online. Or is there a completely different & better way to do this? TIA!!!

EDIT:

I realize I forgot to load the xlrd library so I added these lines to the top. Now, the ‘partipipant number’ screen will pop up, then it crashes after pressing enter. There’s no error message or anything else appearing in the coder view after.

#import
import xlrd

#input file
in_file = 'trialTypes.xlsx'
inbook = xlrd.open_workbook(in_file)