My requirement might be a bit strange, but here it is:
I have a package called handlers
. Outside of this package, I have main.py
. In main.py
, I need to get all the submodules under handlers
. Now I can define __all__
in __init__.py
but that would have to be updated everytime I add a new submodule in the directory. So is there a way to automatically keep __all__
updated?