def walk_modules(path):
    root_mod = __import__(path, {}, {}, [''])
    mods = [root_mod]
    for _, name, ispkg in pkgutil.iter_modules(root_mod.__path__):
        submod_path = '.'.join([path, name])
        if ispkg:
            mods.extend(walk_modules(submod_path))
        else:
            submod = __import__(submod_path, {}, {}, [''])
            mods.append(submod)
    return mods
Given package name, return a list of all modules (including submodules, etc)
dataset/ETHPy150Open ARM-software/workload-automation/wlauto/utils/misc.py/walk_modules