How to get two modules loaded into the same namespace?

Sean 'Shaleh' Perry shalehperry at
Thu Nov 8 17:18:44 CET 2001

> 2) Several functions in refer back to functions in  
> They also return a NameError (see stacktrace below 
> from an actual debug log)
>     File "D:\Dev\PyCharGen\", line 157, in calcSpells
>     statLevel = find(stat, 'base') + find(stat, 'bonus')
>     NameError: global name 'find' is not defined
>     Process terminated with exit code 0
> Again, it seems that the two modules are not in the same namespace.
> Both python 2.1.1 and 2.2beta show this behavior.
> Does anyone know a solution (other than putting the utility functions 
> in to this problem? I must admit that I got lost at 
> the Python namespace rules before...

this is bad design that will haunt you through all of your next lives.  If The
items in are actually just utilities then they should not be
referencing your other module.  Either you left a utility in the other module
or you need to rethink your design some.  Perhaps you can pass in the function
as an argument?

More information about the Python-list mailing list