ctrl = controller
‘controller’ is a module, representing your whole ‘controller.py’ file. In Python, unlike in Java, there can be any number of symbols defined inside a module, so there isn't a 1:1 relationship between the imported module and the class defined in it.
So the script complains because the ‘controller’ module does not have a ‘div’ function; ‘div’ is defined as a method of the ‘controller’ class inside the ‘controller’ module. If you want an instance of the controller() class you need to say:
ctrl= controller.controller()
(Note also the () to instantiate the object, or you'll be getting the class itself rather than an instance. If you do really want to define a static method in the class so you can call it without an instance, you can do this using the ‘staticmethod’ decorator and omitting ‘self’.)
It's usually best to name your classes with an initial capital to avoid confusion:
class Controller(object):
...
ctrl= controller.Controller()