diff options
Diffstat (limited to 'curunir.py')
-rw-r--r-- | curunir.py | 14 |
1 files changed, 9 insertions, 5 deletions
@@ -6,14 +6,18 @@ from config import config class ModuleManager: def __init__(self, config): self.config = config - self.modules = [] + self.modules = {} for mod in config['modules']: - self.load(mod) + self.get(mod) - def load(self, name): - mod = __import__('modules.' + name, globals(), locals(), ['Module']) - self.modules.append(mod.Module(self)) + def get(self, name): + if not name in self.modules: + mod = __import__('modules.' + name, globals(), locals(), ['Module']) + self.modules[name] = mod.Module(self) + + return self.modules[name] + run = True |