tags:

views:

60

answers:

3

If I have one view which called myview1.py and I want to call a view which is located in myview2.py, how can I do that?

should I import myview2.py somehow?

+2  A: 

You should be able to just do

import myview2

and be able to access it's methods from there, assuming myview2.py is in your include path.

brennie
from helpdesk.views.myview2 import * ? or what do you mean I don't understand
holms
Sorry, I made a typo; what I meant to type import myview2 (or rather import helpdesk.views.myview2). Then you can access all functionality through the imported modulee.g. x = myview2.someClass()
brennie
+3  A: 

I think you need to read about modules, but here's the cheat sheet:

$ cat gilliam.py
def spam():
    print 'eggs'
$ cat jones.py
import gilliam
gilliam.spam()
$ python jones.py
eggs
msw
+3  A: 

just import it

from myview2 import viewname1, viewname2

value = viewname1(params)
Tauquir