Allow me to hijack this thread for a related question. How do you usually import a module from a module. I've tried using local_import but I had problems (don't remember details) so I solved the problem by hardcoding the path like 'applications.<appname>/modules/...' but don't like it. Can local_import do this and I used it incorrectly?
Thanks a lot in advance. Best regards, Tiago ------ On Fri, Feb 26, 2010 at 2:11 AM, Thadeus Burgess <[email protected]>wrote: > Done. > > -Thadeus > > > > > > On Thu, Feb 25, 2010 at 7:06 PM, Jonathan Lundell <[email protected]> > wrote: > > On Feb 25, 2010, at 4:19 PM, mr.freeze wrote: > > > >> Just do: dt = local_import('datatables') > > > > Thanks. Maybe the book should reflect this: > http://web2py.com/book/default/section/4/18 > > > > (I'd make the change, but I'm a little fuzzy on the details.) > > > >> > >> On Feb 25, 6:11 pm, Jonathan Lundell <[email protected]> wrote: > >>> I've made a module that does a nice job, if I do say so myself, of > encapsulating DataTables (I'll post something about it eventually). > >>> > >>> Since it's a module, I need to import it to my controller, which I'm > doing like so: > >>> > >>> import sys > >>> sys.path.append(request.folder) > >>> import modules.datatables as dt > >>> > >>> My question: is there a better way to manage this? At first I was > building the import path all the way from the web2py base, but I didn't want > to include the literal application name. > > > > > > -- > > You received this message because you are subscribed to the Google Groups > "web2py-users" group. > > To post to this group, send email to [email protected]. > > To unsubscribe from this group, send email to > [email protected]<web2py%[email protected]> > . > > For more options, visit this group at > http://groups.google.com/group/web2py?hl=en. > > > > > > -- > You received this message because you are subscribed to the Google Groups > "web2py-users" group. > To post to this group, send email to [email protected]. > To unsubscribe from this group, send email to > [email protected]<web2py%[email protected]> > . > For more options, visit this group at > http://groups.google.com/group/web2py?hl=en. > > -- You received this message because you are subscribed to the Google Groups "web2py-users" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/web2py?hl=en.

