← Back to team overview

sikuli-driver team mailing list archive

Re: [Question #289066]: Variable values not carrying over to functions called from separate scripts

 

Question #289066 on Sikuli changed:
https://answers.launchpad.net/sikuli/+question/289066

Jimmy Bartlett gave more information on the question:
OK, I tried removing the underscores from the file names, and that seems
to have solved that problem. But now I'm having the issue where any
standard Sikuli command, like switchApp(), won't work when part of a
function called in as a module. The error message says "[error]
NameError ( global name 'switchApp' is not defined )"

Example code that reproduces this error:

 # Test.sikuli:
import os,sys,TestFunction
var1 = "VAR1"
var2 = "VAR2"
TestFunction.runTest(var1, var2, var3)

# TestFunction.sikuli:
from sikuli import *
def runTest(var1, var2, var3):
    from TestLib import *
    switchApp('firefox')
    wait(5)
    print var1
    print var2
    print var3

# TestLib.sikuli
var3 = "VAR3"

-- 
You received this question notification because your team Sikuli Drivers
is an answer contact for Sikuli.