recursive import

oj ojeeves at
Tue Jul 1 15:13:57 CEST 2008

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:


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.

More information about the Python-list mailing list