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
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
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
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
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
--