Referencing one script from another

I’m making a game. I have a script that references another script. The script that it references is called GameVars, and it most definitely exists. When I type:

import GameVars

it says that there is no module named GameVars. How can I fix this? Thanks.

Is your ‘GameVars’ file in the blender internal editor, if so, make sure that it ends in ‘.py’, otherwise it won’t import

Presuming this would work, GameVars.py should be in the bpymodules folder, rather than the Scripts folder. (where the script that calls GameVars. should be)
hope this helps.
m.a.

Yes they are in the internal editor and both end in .py

@Meta-Androcto - that probably would work, but you can just have a .py file in the blender text editor and then import that

@mindblender - so when you run this (from the game engine?), it gives you something like this in the console:

 ImportError: No module named GameVars 

yes exactly like that

try doing this.
put this into a new buffer called ‘Text’:

 
import HELLOX 
HELLOX.printx()

then put this into a new buffer called ‘HELLOX.py’:

 
def printx():
    print "X" 

then press Alt+P while in the ‘Text’ buffer. This is my exact setup and it works for me.

Thanks dreblen I fixed it, but I now have another problem. Is it possible to have a variable that isn’t just an integer (so it can have a decimal)? Thanks again.

reference your variable with ‘float(var_name)’