The two basic options for embedding python go something like this:
Blocking execution: run in one thread, intersperse your code with calls to the high level PyRun*() functions
- ... do some stuff ... run python ... do some more stuff ... run more python ...
- ... do some stuff ... do some more stuff ...
- ... run python .... run more python ...
If you are only running truly short scripts, the first one might work -- though you will definitely want some way to abort scripts that enter an infinite loop. ( the code in this post could be adapted to do just that )
For the long haul, the second one will work must better, but it will definitely take more thought and more work up front. For quick and dirty integration, especially if you are in a situation where you are embedding scripting in order to support debugging and prototyping and don't intend to ship with Python as part of your game that extra work may be a burden.
Ideally, there would be an alternative embedding where you could run python for a small slice of time during each single frame.
See full post...