You might import sendgrid in "model" file named "test" In the "test" controller, use the sendgrid namespace. In am doing this kind of stuff successfully in my app.
HTH ---Vineet On Saturday, May 26, 2012 12:49:08 AM UTC+5:30, Yarin wrote: > > For the first time I'm having trouble importing a module in web2py that > imports normally elsewhere. I can't understand why this would be so. > > I'm trying to use the SendGrid Python API. I have the sendgrid library in > my modules folder like all my other modules, and I was trying to import per > the sample code, but get a > <type 'exceptions.NameError'> name 'sendgrid' is not defined > error. > > But when I do the same import from a flat file using the command line, it > runs fine. > > Here is my controller code, and the sendgrid library is > here<https://github.com/sendgrid/sendgrid-python/tree/master/sendgrid> > . > > def test(): > import sendgrid > > return 'import worked' > > >