I am developing a Python App Engine app, where I want to split the content of a source code file Models.py into separate files for each model, but I want to put it all in a folder called Models. The problem is that when I do that, my app can’t find the classes anymore. What should I do?
This question is not about MVC but another question with the same title is.
Put an empty
__init__.pyfile in the Models directory.Then, in your app; presumably one level up, you reference modules in the Models directory like this:
and do something with it like this:
You can also use the
fromkeyword like this:and reference like this:
If you only need one method from a module, you could also do this:
Obligatory link to the documentation.