Create controller how?

I have check erpnext code there is a controller folder and inside there is a parent class. e.g AccountsController, etc. I tried to create a folder controller and create a simple class. e.g.

class SimpleClass(Document):
    def validate(self):
        print "test"
        

and in a doctype I tried to use the class

from wela.controllers.simple_class import SimpleClass

class TestClass(SimpleClass):
      def validate(self):
           print "hi"

my problem is SimpleClass is unresolve reference. Any idea why?

@ccfiel, it follow the Python principle of module and packages, each folder in the path should have a __init__.py file inside, without this, Python cannot resolve the reference.

1 Like

@max_morais_dmm thanks! Sorry for a noob question. :smiley: