[Baypiggies] how to programmatically invoke: from module import *

Alex Martelli aleax at google.com
Tue Mar 3 19:27:34 CET 2009


vars(__import__('module')) should get you a dictionary close to what
you desire.  It may need tweaking because it does not apply the extra
restrictions that "import *" does (__all__ and leading underscores).


Alex


On Tue, Mar 3, 2009 at 9:55 AM, Tung Wai Yip <tungwaiyip at yahoo.com> wrote:
> I always have some trouble in understanding the API for modules importing
> like the __import__(). And this one I really need some help. How can I
> programmatically invoke: from module import *? I want to put the references
> in a dictionary and pass it some other module.
>
> Thank you,
>
> Wai Yip
>
> _______________________________________________
> Baypiggies mailing list
> Baypiggies at python.org
> To change your subscription options or unsubscribe:
> http://mail.python.org/mailman/listinfo/baypiggies
>


More information about the Baypiggies mailing list