When starting to learn oTree, you may face uncertainty about where to
        put a particular piece of code. Should it go in
        before_next_page, after_all_players_arrive,
        creating_session, etc? Should it be a player,
        group, or subsession
        function?
      
Here is a quick guide comparing these various functions.
creating_session is where
          you can put "setup" code, such as predetermining treatment groups.
          This function cannot depend on anything that happens during the
          session. For that, you should instead use
          before_next_page or
          after_all_players_arrive.
        after_all_players_arrive executes just once for the whole
          group, whereas before_next_page executes separately for
          each player.
        before_next_page, which is guaranteed to only execute
          once.
        def set_payoffs(group): You can define
          player/group/subsession functions with whatever name you want, but
          unlike built-in functions, oTree won't execute these functions
          automatically. It's up to you to call these functions from a built-in
          function such as creating_session,
          before_next_page, etc.