is it PyQT related problem, or are you looking at a simple problem of
reimporting python modules after editing them? for later, we just use a
"unload" mechanic. that is, we're not hotswapping new versions of
modules, resolving dependencies would be too hard; we're unloading every
single bit of code so that it's read from disc next time it's loaded.
this is provided your whole code is packaged:
def unload(silent=True,packages=None):
if packages is None:
packages = DEFAULT_RELOAD_PACKAGES
# construct reload list
reloadList =[]
for i in sys.modules.keys():
for package in packages:
if i.startswith(package):
reloadList.append(i)
# unload everything
for i in reloadList:
try:
if sys.modules[i] is not None:
del(sys.modules[i])
if not silent:
print "unloaded "+i
except:
print "failed to unload "+i
nevermind the "default reload packages" constant, it's just the default
list of packages to unload for our toolkit.
example usage of this function would be:
unload(packages=['com.example.project1','com.example2.projectDependency2'])
unload(packages=['example3.dependency3'])
What it will do is look for loaded packages that start with names
provided, and delete those from python cache. It does not perform
reimporting; packages will be reimported next time you execute your code.
--
http://groups.google.com/group/python_inside_maya