Created
June 18, 2021 19:06
-
-
Save AbirRazzak/94375f4659c91d52a224683a5f3d2d90 to your computer and use it in GitHub Desktop.
Get All Modules in Python Project
This file contains 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
def get_py_modules(): | |
modules = [] | |
path = 'some/path' | |
path_walk = os.walk(path) | |
_, dirs, _ = next(path_walk) | |
for module_dir in dirs: | |
if os.path.exists(os.path.join(path, module_dir, '__init__.py')): | |
modules.append(module_dir) | |
modules.sort() | |
pass # do stuff |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment