I’m not a python expert, so I can’t really say why this doesn’t work. but it seems to me since only the function is called and not the import of the module, it doesn’t know about sqrt when called from the other script. You would think that maybe adding the module import to the function would work, but for some reason even most(?) builtin functions are not callable.
The only way I can think of to make this work is to import the module in the calling script and pass it as an argument to the root() function:
# Call script
print GameLogic.root(math, x)
and change the root function in the define script to something like:
def root(mathmodule, x):
if you only need the sqrt function however, the simplest solution is to just use ** instead, no math module needed: