Skip to content

Instantly share code, notes, and snippets.

@Deaygo
Deaygo / plugin.py
Created March 9, 2016 16:45 — forked from will-hart/plugin.py
A simple python plugin system using a custom metaclass
# a simple Python plugin loading system
# see http://stackoverflow.com/questions/14510286/plugin-architecture-plugin-manager-vs-inspecting-from-plugins-import
class PluginMount(type):
"""
A plugin mount point derived from:
http://martyalchin.com/2008/jan/10/simple-plugin-framework/
Acts as a metaclass which creates anything inheriting from Plugin
"""
class NerdMessage {
private NerdMessageAPI api = null;
public NerdMessageAPI getAPI() {
if (api == null) {
api = NerdMessageAPI(this);
}
return api;
}