Skip to content

Instantly share code, notes, and snippets.

@FurryHead
Created June 3, 2011 21:02
Show Gist options
  • Save FurryHead/1007167 to your computer and use it in GitHub Desktop.
Save FurryHead/1007167 to your computer and use it in GitHub Desktop.
def pluginExists(self, pluginName):
if os.path.exists(pluginName.replace(".", os.sep)+".py"):
f = __import__("plugins."+pluginName.split(".")[0], fromlist=[pluginName.split(".")[1]])
try:
getattr(f, pluginName.split(".")[1])
del f
del sys.modules["plugins."+pluginName.split(".")[0]]
return True
except AttributeError:
del f
del sys.modules["plugins."+pluginName.split(".")[0]]
return False
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment