I have an application which will be extensible by Python code but the extensing code will also be using code from the application. Example of what I am trying to achieve:
// wrapped_module.cpp
void api_call()
{
std::cout << "API call" << std::endl;
}
BOOST_PYTHON_MODULE(API)
{
boost::python::def("api_call", api_call);
}
// extension.py
import API
def myExtension()
# ... some python work ... #
API.api_call()
// application_main.cpp
int main()
{
// initialize interpreter
// load "extension.py"
// make "API" module available for "extension.py", so "import API" works
// load "myExtension" from "extension.py"
// myExtension()
// <see "API call" in console output>
return 0;
}
"extension.py" will never be called as a standalone script, it will always be loaded by c++ application - therefore I do not need to separately build API.dll module for python to import - or do I?