En Sat, 24 May 2008 08:57:37 -0300, ohad frand <[EMAIL PROTECTED]> escribió:
> Thanks for your reply but it stil didnt work: > i opened python shell, changed active directory to \\one and imported tmp1. > now the correct file is loaded. > now i deleted tmp1 > i dir os.chdir(\\two) and imported tmp1 again. now the incorrect file is > loaded (the same one as before). > i did one more trial with sys.path insted of os.chdir() and it didnt work > either (sys.path.append(\\one), import tmp1, del tmp1, sys.path.remove(\\one), > sys.path.append(\\two), import tmp1) > can you please try to do so and see for yourself that something is wrong > here. If you want Python to forget about module tmp1: del sys.modules['tmp1'] But most of the issues with reload apply too http://docs.python.org/lib/built-in-funcs.html#l2h-61 > The reason why i am not using other names is because i am triyng to build > something that will execute external sw and for that i have no control of > the names of the modules, but this is not important, because python must > give us a way to clear previously imported module See http://docs.python.org/ref/import.html to see how the import statement works, and PEP 328 http://docs.python.org/whatsnew/pep-328.html to see how using relative imports can help in this case, but not without some help from the external modules themselves. Anyway I don't understand your usage of execfile. Maybe you're after some form of plugin system? (search past messages with those keywords) -- Gabriel Genellina -- http://mail.python.org/mailman/listinfo/python-list