Re: import multiple modules with same name

2008-04-01 Thread Konstantin Veretennicov
On Mon, Mar 31, 2008 at 11:52 PM, Christian Bird [EMAIL PROTECTED] wrote: Is it possible to import multiple modules with the same name from different locations? This might work: import imp util1 = imp.load_source('util1', 'mod1/util.py') util2 = imp.load_source('util2', 'mod2/util.py

import multiple modules with same name

2008-03-31 Thread Christian Bird
Is it possible to import multiple modules with the same name from different locations? I'm using two different pieces of software, both of which have a module named util.py. I know that I can modify sys.path to fix which util gets imported when I do: import util I'd like to be able to do

Re: import multiple modules with same name

2008-03-31 Thread Gary Herron
Christian Bird wrote: Is it possible to import multiple modules with the same name from different locations? I'm using two different pieces of software, both of which have a module named util.py. I know that I can modify sys.path to fix which util gets imported when I do: import util I'd

Import: Multiple modules with same name

2006-06-30 Thread Amit Khemka
Hello All, I have multiple modules with same name in different directories (well I guess thats may not be a good practise, but i needed it for debugging and working with various versions). Now how do I import a module with specifying a path. Few minutes of googling suggested: import ihooks

Re: Import: Multiple modules with same name

2006-06-30 Thread Fredrik Lundh
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 --