Say I have the following code:
from foo.bar import Foo
from foo.foo import Bar
__all__ = ["Foo", "Bar"]
def iterate_over_all():
...
How can I implement code in the function iterate_over_all()
that can dynamically obtain references to whatever is referenced in __all__
the module where the function is implemented? IE: in iterate_over_all()
I want to work with foo.bar.Foo
and foo.foo.Bar
.