I would like to load one of the scipy modules (scipy.linalg) inside a function which is exported from a python extension written in C++, so that I can then call a function from it. It would be best if the user to does not have to load the module in their python program beforehand (so PyImport_AddModule
is not the solution).
Code using the high level PyImport_Import
like this
pckg_name = PyString_FromString("scipy.linalg");
pckg = PyImport_Import(pckg_name);`
works, as recommended here, except in Python 3.6 it produces a warning message before working.
C:\Program Files\Python36\lib\importlib\_bootstrap.py:205:
ImportWarning: can't resolve package from __spec__ or __package__,
falling back on __name__ and __path__
return f(*args, **kwds)
What does the message mean? Its presence suggests I am not doing this the right way. What is the right way to do this?