]> jfr.im git - erebus.git/blobdiff - ctlmod.py
begin adding a centralized HELP command
[erebus.git] / ctlmod.py
index 8cfa7d04e34d3b2d4d7afa9686b6e5177ed7fa2e..db8a5b88f63a3d1a35a5495341cbd57f7f8b98f5 100644 (file)
--- a/ctlmod.py
+++ b/ctlmod.py
@@ -12,12 +12,15 @@ def modhas(modname, attname): return getattr(modules[modname], attname, None) is
 
 def load(parent, modname):
        if not isloaded(modname):
+               sys.path.insert(0, 'modules')
                try:
                        mod = __import__(modname)
                        reload(mod) #in case it's been previously loaded.
                except BaseException as e: #we don't want even sys.exit() to crash us (in case of malicious module) so use BaseException
                        return modlib.error(e)
-                       
+               finally:
+                       del sys.path[0] #remove ./modules from path, in case there's a name conflict
+
 
                if not hasattr(mod, 'modinfo'):
                        return modlib.error('no modinfo')