oTree Forum >

import modules in oTree

#1 by martin

Hi, I'm building my first apps with oTree.

I notice my __init__.py files tend to get really large. To solve it, I tried creating subfiles and importing them as modules, as follows:

from classes import *
from function import *
from pages import *

I realize this is more the old-school oTree, but I like it better. However, this doesn't seem to work. 
Is there any way to do somethin like this?



#2 by Chris_oTree

I don’t really recommend that style. You will get best results and fewest surprises if you put all oTree stuff in __init__.py. Unless you have your own modules with non-oTree stuff like stats functions etc.

#3 by martin

Thanks for the quick response Chris!

Will follow that advise

Write a reply

Set forum username