Reputation: 9560
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?
Upvotes: 2
Views: 127
Reputation: 6913
just import
it
from myview2 import viewname1, viewname2
value = viewname1(params)
Upvotes: 3
Reputation: 43487
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
Upvotes: 3
Reputation: 543
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.
Upvotes: 2