Import: Multiple modules with same name

Fredrik Lundh fredrik at pythonware.com
Fri Jun 30 03:00:25 EDT 2006


Amit Khemka wrote:

> But It looked like an overkill, Is there a more elegant and better way
> of doing it ?

    try:
        path = sys.path[:]
        sys.path.insert(0, mypath) # or something
        import mymodule
    finally:
        sys.path = path

</F> 






More information about the Python-list mailing list