How to pass variables in the game engine to a newly loaded .blend? I have two blend files, a.blend and b.blend.

I open a.blend, and run the game engine P. A script is then run that uses the function bge.logic.startGame("b.blend"), which starts running the game setup in b.blend.

In b.blend, another script runs. This one needs a value that is in a script in a.blend. How can I pass a var from a script in a.blend to the script in b.blend?
You could dump it to a file.

a.blend

with open('/tmp/mydata', 'w') as f:
    f.write(a_setting)


b.blend

with open('/tmp/mydata', 'r') as f:
    b_setting = f.read()