Hi Tom,

Here's a good explanation I found via Google:
http://effbot.org/zone/import-confusion.htm

if you have a file datamodel that contains a class name modelName, you can do:

from datamodel import modelName

-Marzia

On Thu, Jan 29, 2009 at 4:48 AM, tom s <[email protected]> wrote:
>
> Hi, I'm a n00b to python and GAE, so apologies in advance for the
> naivety of this question..
>
> My app has multiple .py files, which share db models.
> So to avoid repetition, I want a single file that has the db model
> definitions, such as 'datamodel.py'.
> I can then import that into my main.py with 'import datamodel'.
> To then use the model I need to do 'datamodel.modelName'.
>
> Is there a way to avoid the 'datamodel.' part, so that I can address
> it directly as 'modelName'?
> I suspect this has something todo with namespaces, but I dont really
> understand it.
> thanks,
>
> tom
>
>
>
> >
>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Google App Engine" 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/google-appengine?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to