Steven Reddie wrote:
        MODULES = [ 'module1', 'module2' ]

        def libinfo():
                for m in MODULES:
                        __import__('libinfo.'+m)
                        m.libinfo()
                        CFLAGS+=m.CFLAGS

Does this do what you want?

---------- libinfo/__init__.py ----------
-----------------------------------------

---------- libinfo/module1.py ----------
def libinfo():
    return "module1"
----------------------------------------

---------- libinfo/module2.py ----------
def libinfo():
    return "module2"
----------------------------------------

py> modules = ['module1', 'module2']
py> libinfo = __import__('libinfo', globals(), locals(), modules)
py> for module in modules:
...     getattr(libinfo, module).libinfo()
...
'module1'
'module2'

STeVe
--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to