text: For something I am working on, I needed the ability to scan a supplied directory, adding the directory to the sys.path within Python, and then blanket import the modules within that directory. Following that, I had to filter any builtin or special methods within those modules and return a list of the methods for the module I had imported.
  The script is very simplistic in what it does.
  Discussion
  This may not be terribly useful to many people - in most cases, not only will you know the module name, but you will also know the methods accessible to you within the module.
  Usage example: jesse$python loader.py mydir/
  imported module: basic imported module: mod1 imported module: mod2 ['a_a', 'a_b', 'a_c', 'a_d', 'a_e'] [] []
  You can use this script, as well as getattr() to actually call the functions returned in the list.
  Suggestions welcome!
  Import module from directory. I believe the proper way is to add a site path using site.py and friends but just to add a module from a subdir within a portable project this works a charm, thanks to above.
  replace --indent-- with spaces or tabs
  import os
  import sys
  dir='./uspp' #your dir here
  if os.path.isdir(dir):
  --indent--sys.path.append(dir)
  import uspp