PyImport_ImportModule

Charlie Barrows charlie at gabrielinteractive.com
Fri Mar 16 21:52:53 CET 2001


Right, so if I wanted to import TestScript into __main__ (ala "from module
import *"), is that possible using PyImport_ImportModuleEx?  If so, what
parameters am I providing incorrectly, it seems I've tried them all.


"Fredrik Lundh" <fredrik at pythonware.com> wrote in message
news:Zgrs6.170$sk3.49958 at newsb.telia.net...
> Charlie Barrows wrote:
> > I'm just starting to tinker with embedding Python in a C app and I'm
trying
> > to get a handle on where modules end up when they're imported.
> >
> > If I run this code:
> >
> > PyObject *module = PyImport_ImportModule("TestScript");
> >
> > ... which namespace is TestScript imported into?
>
> it's own namespace, of course.
>
> ImportModule is the same thing as "import module", not
> "from module import *".
>
> Cheers /F
>
>





More information about the Python-list mailing list