[C++-sig] Re: import from c++?

Neal D. Becker ndbecker2 at verizon.net
Wed Sep 8 16:09:43 CEST 2004


David Abrahams wrote:

> "Neal D. Becker" <ndbecker2 at verizon.net> writes:
> 
>> I have 2 modules written with boost::python.
>>
>> I have module A that exposes a class a, and now module B needs a.  If a
>> python program then imports A and B, it works fine.  My question is, is
>> there some way I can add code to the boost:python module B to cause
>> importing of A?
> 
>         PyRun_String("import a")
> 
> or whatever?
> 

BOOST_PYTHON_MODULE(whatever)
{
  //  PyRun_SimpleString("import a");  << this works
  PyImport_Import (str ("a").ptr());   << even better I think




More information about the Cplusplus-sig mailing list