I just upgraded to 2.47 from 2.45 and have noticed a couple of significant changes in python execution. They don’t seem to be documented anywhere(??) so I’ll describe them here, along with my work-arounds. Let me know if you can think of any better ones/have better explanations.
- It used to the case that a new instance of the Python runtime was created each time the game is run. In 2.47, they all run in the same instance of the runtime. This means externally loaded scripts are not reloaded between runs and therefore won’t reflect any changes you’ve made.
Work-around: call ‘reload(<your_external_modified_script>)’ each time the game runs.
- The game engine thread is now very greedy (??). Therefore other threads may not get a chance to execute.
Work-around: create a new sensor that calls time.sleep(0.001) every so often to allow other threads to get control (make sure the other threads sleep too).