I am having little problem with importing classes in python. My work flow goes like this
index.py
class Template:
def header():
def body():
def form():
def footer():
display.py
I want to call function header(), body() and footer () in my display.py page. Will anyone make me clear about this issue in python. Thanks for your concern.
Index file— [Index.py][1]
[1]: http://pastebin.com/qNB53KTE and display.py — “http://pastebin.com/vRsJumzq“
At the bottom of your index file you create a
HtmlTemplateobject and call all the methods on it. Since this code is not contained in any other block, it gets executed when you import the module. You either need to remove it or check to see if the file is being run from the command line.