If I understand you right, your code already lets you do what you want to do.
When you do globals()[name] = value
, you create a global variable in __init__.py
. Global variables in __init__.py
are what determines what is available under the package namespace. So if in your code you wind up creating a variable some_controller
in __init__.py
, then you will be able to do controllers.some_controller
.
__all__
only affects what is imported when you use from module import *
. By modifying __all__
, you are affecting what will happen if you do from controllers import *
, but you're not affecting what will be available under controllers
if you just do import controllers
.