def load_from_dir(dirpath, varname):
    """
	returns a list of all variables named 'varname' in .py files in a directofy 'dirname'.
	"""
    if not os.path.isdir(dirpath):
        return []
    ret = []
    for fn in os.listdir(dirpath):
        fp = os.path.join(dirpath, fn)
        if not os.path.isfile(fp):
            continue
        with open(fp, "r") as fin:
            mod = imp.load_source(fn[:fn.index(".")], fp, fin)
        if not hasattr(mod, varname):
            continue
        else:
            ret.append(getattr(mod, varname))
    return ret

	returns a list of all variables named 'varname' in .py files in a directofy 'dirname'.
	
lib/stashutils/core.py