__import__ built-in function the pyrun_string call is the one that actually runs code herethough it takes code stringa parser mode flagand dictionary object pointers to serve as the global and local namespaces for running the code string the mode flag can be py_eval_input to run an expression or py_file_input to run statementwhen running an expressionthe result of evaluating the expression is returned from this call (it comes back as pyobjectobject pointerthe two namespace dictionary pointer arguments allow you to distinguish global and local scopesbut they are typically passed the same dictionary such that code runs in single namespace example - pp \integrate\embed\basics\embed-string /code-strings with results and namespaces *#include main(char *cstrpyobject *pstr*pmod*pdictprintf("embed-string\ ")py_initialize()/get usermod message *pmod pyimport_importmodule("usermod")pdict pymodule_getdict(pmod)pstr pyrun_string("message"py_eval_inputpdictpdict)/convert to *pyarg_parse(pstr" "&cstr)printf("% \ "cstr)/assign usermod *pyobject_setattrstring(pmod" "pstr)/print usermod transform( *(voidpyrun_string("print(transform( ))"py_file_inputpdictpdict)py_decref(pmod)py_decref(pstr)py_finalize()when compiled and runthis file produces the same result as its predecessor/pp /integrate/embed/basics/embed-string embed-string the meaning of life the meaning of python howeververy different work goes into producing this output this timec fetchesconvertsand prints the value of the python module' message attribute directly by basic embedding techniques