code: def import_plugin(name):
      
      path = os.path.join("plugins", name + ".py")
      try:
          with open(path, 'rb') as f:
              try:
                  plugin = imp.load_module(
                      "p_" + name, f, name + '.py',
                      ('.py', 'rb', imp.PY_SOURCE)
                  )
              except SyntaxError as e:
                  error = "Found plugin '{0}', but it seems".format(name)
                  error += " to have a syntax error: {0}".format(str(e))
                  abort(error)
      except IOError:
          abort("Sorry, could not find '{0}.py' in the plugin directory".format(
                name))
      return plugin
docs: Imports plugin python module