def whereis_in_globals(fname):
    return [m for m in sys.modules.values() if module_has_function(m,
        fname)]

def whereis_in_locals(fname):
    modules = (__import__(module_name, globals(), locals(), [fname], -1) for
        _, module_name, _ in pkgutil.walk_packages(path='.'))
return [m for m in modules if module_has_function(m, fname)]

def module_has_function(m, fname):
    return hasattr(m, fname) and inspect.isfunction(getattr(m, fname))
if __name__ == '__main__':
    for m in whereis_in_locals('walk'):
        pass
В Python, учитывая имя функции, как получить все модули, содержащие функцию?