On Jun 11, 1:45 pm, "Diez B. Roggisch" <[EMAIL PROTECTED]> wrote:

> Is it cursed upon? Didn't know that.
I didn't either.  Until I asked some people how to do it, and was
admonished for even suggesting the concept.


> However, __import__ only gives you the topmost module - in your case myapp.
ah, i didn't know that!  thanks!


> So you need to do it like this (untested):
>
> name = "a.b.c.d"
> mod = __import__(name)
> for part in name.split(".")[1:]:
>      mod = getattr(mod, part)
> print mod

interesting approach.  unfortunately, it raises AttributeError: 'a'
object has no attribute 'b'

i think i'm going to table this approach.  sigh.

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

Reply via email to