naturallystrings of python code run by probably would not be hardcoded in program file like this they might instead be loaded from text file or guiextracted from html or xml filesfetched from persistent database or socketand so on with such external sourcesthe python code strings that are run from could be changed arbitrarily without having to recompile the program that runs them they may even be changed on siteand by end users of system to make the most of code stringsthoughwe need to move on to more flexible api tools pragmatic detailsunder python and cygwin on windowsi had to first set my pythonpath to include the current directory in order to run the embedding exampleswith the shell command export python pathi also had to use the shell command /embed-simple to execute the program because was also not on my system path setting and isn' initially when you install cygwin your mileage may varybut if you have troubletry running the embedded python commands import sys and print sys path from to see what python' path looks likeand take look at the python/ api manual for more on path configuration for embedded applications running code strings with results and namespaces example - uses the following api calls to run code strings that return expression results back to cpy_initialize initializes linked-in python libraries as before pyimport_importmodule imports python module and returns pointer to it pymodule_getdict fetches module' attribute dictionary object pyrun_string runs string of code in explicit namespaces pyobject_setattrstring assigns an object attribute by namestring pyarg_parse converts python return value object to form the import calls are used to fetch the namespace of the usermod module listed in example - so that code strings can be run there directly and will have access to names defined in that module without qualifications py_import_importmodule is like python import statementbut the imported module object is returned to cit is not assigned python/ integration