Skip to content

Instantly share code, notes, and snippets.

@thequbit
Created April 1, 2015 18:21
Show Gist options
  • Save thequbit/f54b25e35bdac9fcef31 to your computer and use it in GitHub Desktop.
Save thequbit/f54b25e35bdac9fcef31 to your computer and use it in GitHub Desktop.
import os
import imp
_commands = []
files = [f for f in os.listdir('.') if os.path.isfile(f)]
for f in files:
filename, extention = os.path.splitext(f)
if filename[0:4] == '_cmd_' and extention == '.py':
module = imp.load_source(filename, '.')
if hasattr(modle, 'CommandClass'):
_commands.append(getattr(py_mod, expected_class)())
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment