recursive import

O

oj

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,774
Messages
2,569,599
Members
45,175
Latest member
Vinay Kumar_ Nevatia
Top