Let's say I have a module object foo and I want to dynamically add module bar to it at import time. How can I accomplish that?
Work done so far:
I've been trying to accomplish this by adding bar to the __init__.py file for foo.
bar = function_that_returns_module_bar()
This allows me to do
from foo import bar
However the following fails
import foo.bar
Furthermore, let's say bar has a submodule baz, I'm also unable to do
from foo.bar import baz
Is what I'm describing possible?