Created
December 7, 2018 06:11
-
-
Save sungmin-park/fecf26d96c6ce68f04479e5c242ae803 to your computer and use it in GitHub Desktop.
import flask blueprints
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import pkgutil | |
import sys | |
def load_submodules(module) -> None: | |
for finder, name, is_pkg in pkgutil.iter_modules(module.__path__): | |
module_name = f"{module.__name__}.{name}" | |
if module_name not in sys.modules: | |
module = finder.find_module(module_name).load_module() | |
print(f" * import {module.__name__} - Ok") | |
else: | |
module = sys.modules[module_name] | |
print(f" * import {module.__name__} - Passed") | |
if is_pkg: | |
load_submodules(module) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment