from otree.api import * doc = """ Your app description """ class C(BaseConstants): NAME_IN_URL = 'choose_random_app' PLAYERS_PER_GROUP = 2 NUM_ROUNDS = 1 ACTIVE_ROLE = 'Active player' PASSIVE_ROLE = 'Passive player' class Subsession(BaseSubsession): @staticmethod def creating_session(subsession): subsession.group_randomly(fixed_id_in_group=True) print(subsession.get_group_matrix()) class Group(BaseGroup): app_to_pay = models.StringField() @staticmethod def set_payoffs(groups): Active = group.get_player_by_role(C.ACTIVE_ROLE) Passive = group.get_player_by_role(C.PASSIVE_ROLE) class Player(BasePlayer): app_to_pay = models.StringField() # PAGES class PayRandomApp(Page): @staticmethod def before_next_page(group: Group, timeout_happened): import random participant = group.participant # print('participant.app_payoffs is', participant.app_payoffs) apps = [ 'condition1', 'condition2', 'condition3', 'condition4', 'condition5', 'condition6', 'condition7' ] app_to_pay = random.choice(apps) group.app_to_pay = app_to_pay class Results(Page): pass page_sequence = [PayRandomApp, Results]