Using an if statement based on counterbalancing groups?

Hello,

Probably a simple question but as I’m still fairly new to creating studies in Psychopy and with code I thought I’d ask. I’m trying to display some text based upon which group (counterbalancing group) the participant was assigned to. Essentially if they were assigned to group zero I want them to see one thing, and if assigned to group 1, another. I thought I’d do this with some simple code:
if counterbalance.group == 1:
txt1 = “This is A”
else:
txt1 = “This is B”

But it always shows “This is B” when running, even if the ppt was assigned to group 1.

Have I made a basic error in trying to read the counterbalance.group variable?

Try

if counterbalance.group == '1':
     txt1 = "This is A"
else:
     txt1 = "This is B"

Thank you!!