Referencing another Python Script in Game Engine

How do I reference another python script and have it work in a runtime.

Example:

import TestScript

TestScript.testvariable="testvalue"

This works fine within Blender, but it never works with the runtime. How do I get this to work? I need a set of variables that only change when I change them. Thanks.

put the .py in the same dir ans the .blend and run the .blend by double clicking on it NOT by opening it from within blender (its a local dir thing)

Hope that works as i believe it should :wink:

Siegel you just made me a very happy man. I owe you big time. You just solved a 3-day long problem for me.

Hello,
I don’t know what your script is about but in the case of a class definition a solution would be to create an instance of this class as a member of the GameLogic module or of any GameObject:

GameLogic.blah=Your_Class_Name(Your_parameters)

or

Owner=GameLogic.getCurrentScene().getObjectList()['OB_object_name']
Owner.blah=Your_Class_Name(Your_parameters_if_any)

Run the script with the class definition and instanciation(s) at game start(alwaysSensor with pulse mode off) and the class instances will be accessible in every other scripts during the game session.

Hope this helps
Also I hope my english isn’t too bad…

Salut / bye