Load three different modules which have the same name

Steve Holden steve at holdenweb.com
Mon Mar 19 17:01:37 EDT 2007


abcd wrote:
> nevermind this took care of it:
> 
> import sys
> 
> def tryAllThree():
>     a = "c:\\alpha"
>     b = "c:\\beta"
>     g = "c:\\gamma"
> 
>     sys.path.append(a)
>     import Person
>     alpha = Person.Person()
> 
>     sys.path.remove(a)
>     sys.path.append(b)
>     reload(Person)
>     beta = Person.Person()
> 
>     sys.path.remove(b)
>     sys.path.append(g)
>     reload(Person)
>     gamma = Person.Person()
> 
> thanks
> 
Blerch! Why not just call the modules by the right names in the first 
place? Then each will have its own sys.modules entry for a start ...

regards
  Steve
-- 
Steve Holden       +44 150 684 7255  +1 800 494 3119
Holden Web LLC/Ltd          http://www.holdenweb.com
Skype: holdenweb     http://del.icio.us/steve.holden
Recent Ramblings       http://holdenweb.blogspot.com




More information about the Python-list mailing list