recursive import

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • oj

    recursive import

    Hi, I'm just toying around with some ideas at the moment.

    Is there an easy and safe way to recursivly import all modules under a
    particular namespace?

    Say, I had modules:

    foo
    foo.bar
    foo.bar.baz
    foo.baz
    bar
    bar.baz

    I want to import all the modules in the foo namespace, so the first
    four modules in that list.

    Other then having those modules explicitly import their children, or
    explicitly importing them all from where I want to use them, can I do
    this? Should I do this?

    The idea is that function decorates 'register' functions in those
    modules, so they become available without having to have a list of all
    the modules that contain them, and without all the modules necessarily
    needing to know about each other.
Working...