Newbie namespace question

Jeff Shannon jeff at
Wed Dec 22 20:02:27 CET 2004

bcarlso at wrote:

>Now, in I have
>class DataSource:
>def __init__(self, servername):
>self.servername = servername
>def create(name, connectionInfo, etc):
>#Call the IBM supplied WebSphere config object
>Run it and get a name error, which, makes sense.
>If I try to use the standard import solution as deelan suggests I have
>a circular reference on the imports and I get an error that it can't
>import class DataSource (presumbably because it hasn't gotten far
>enough through to realize that there's a DataSource class

How about you try this?

def create(name, connectionInfo, ...):
    from configure_server_foo import AdminConfig

This way, won't try to import until 
create() is called.  By deferring that import, you should be able to 
avoid the circular import problem...

Jeff Shannon
Credit International

More information about the Python-list mailing list