Created
June 1, 2012 05:07
-
-
Save tsudot/2848986 to your computer and use it in GitHub Desktop.
loading modules dynamically
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def load(self): | |
self.plugins = ['monit', 'opensips', 'sshd'] | |
self.fetch_config() | |
plugins = {} | |
for plugin in self.plugins: | |
# get_class_name returns the class nume for that plugin, | |
# for a new plugin we need to have a standard class name | |
# for example the module name capitalized with the first word | |
plugins[plugin] = getattr(__import__(plugin), get_class_name(plugin)) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment