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 import os def my_import(filename): loader = ihooks.BasicModuleLoader() path, file = os.path.split(filename) name, ext = os.path.splitext(file) module = loader.find_module_in_dir(name, path) if not module: raise ImportError, name module = loader.load_module(name, module) return module But It looked like an overkill, Is there a more elegant and better way of doing it ? Thanks in advance, cheers, amit. -- ---- Amit Khemka -- onyomo.com Home Page: www.cse.iitd.ernet.in/~csd00377 Endless the world's turn, endless the sun's Spinning, Endless the quest; I turn again, back to my own beginning, And here, find rest. -- http://mail.python.org/mailman/listinfo/python-list