oTree Forum >

Can we still use the self format in oTree 5

#1 by gmdcastillo

Hi there,

I'm currently updating an old app written for oTree 2 to oTree 5 and I'm surprised to see that everything works out of the box apart from a few minor modifications. In particular, all of the self. syntax works, for methods and whatnot.

Can we still use the old self. syntax in oTree 5?

—Geoffrey

#2 by Chris_oTree

yes you can use it. This page lists the differences: https://otree.readthedocs.io/en/latest/misc/otreelite.html

#3 by gmdcastillo

Thanks, great to hear! 

Is it also true for the pages? For example doing

```
class MyPage(Page):

    def vars_for_template(self):
        my_var = self.session.config['var']
```

PyCharm complains about the `self.session`: "Unresolved attribute reference 'session' for class 'MyPage'"
But it seems to work still.

Write a reply

Set forum username