On Oct 30, 1:31 pm, [EMAIL PROTECTED] wrote: > suppose i have imported two modules foo and bar with > foo=PyImport_ImportModule("foo") and bar=PyImport_ImportModule("bar") > respectively. > > Now suppose I have an artitrary python expression to evaluate. > Do I need to parse that thring and check for foo. and bar. before > jumping the usual > PyModule_GetDict,PyDict_GetItemString,PyObject_CallObject hoop hoop on > the PyObject for > the prefix or there is a better way? > > btw PyRun_SimpleString("foo.baz()"); does not work: > Traceback (most recent call last): > File "<string>", line 1, in ? > NameError: name 'foo' is not defined > > and i potentially need a PyObject* back with the result of the > expression anyway.
I'm confused. What is the benefit of importing this way in the first place? Everything I've read has always been either of the following (or a variant thereof): import foo or from foo import bar Mike P.S. Yes, I did see the docs mention this method here: http://docs.python.org/api/importing.html but i have always followed http://effbot.org/zone/import-confusion.htm or http://docs.python.org/ref/import.html -- http://mail.python.org/mailman/listinfo/python-list