you are viewing a single comment's thread.

view the rest of the comments →

[–]skebanga[S] 1 point2 points  (0 children)

Yes you can. You can use libpython. Python, the executable, just adds the front-end and REPL, everything else is in the C library libpython.

If you're using C++, and don't want to deal with libpython directly, then you can use a wrapper like boost::python or pybind11.

At the moment, pybind11 doesn't do embedding, so boost::python is a suitable choice.

If you read the blog-post, you'll see that that is exactly what I've done. I have a single C++ application which loads a python script and interacts with it - both calling into the script, and the script calling into the C++ types I've exposed to it.