App() is not defined in imported def

Asked by core

[error] script [ test ] stopped with error in line 4
[error] NameError ( global name 'App' is not defined )

test.sikuli:

myScriptPath = "c:\\Sik\\test\\testLIb"
if not myScriptPath in sys.path: sys.path.append(myScriptPath)
import testLib
testLib.testFn()

testLib.sikuli:

def testFn():
    testpad = App("calc.exe")
    App.open(testpad)
    popup("Test Fn")
    return()

When the def is in the main sikuli, it works without error.

test2.sikuli:

def testFn():
    testpad = App("calc.exe")
    App.open(testpad)
    popup("Test Fn")
    return()

testFn()

Why the error when using an imported sikuli fn?

Question information

Language:
English Edit question
Status:
Answered
For:
SikuliX Edit question
Assignee:
No assignee Edit question
Last query:
Last reply:
Revision history for this message
RaiMan (raimund-hocke) said :
#1

Look docs.

Von meinem iPhone gesendet

> Am 22.05.2014 um 21:06 schrieb core <email address hidden>:
>
> New question #249144 on Sikuli:
> https://answers.launchpad.net/sikuli/+question/249144
>
> [error] script [ test ] stopped with error in line 4
> [error] NameError ( global name 'App' is not defined )
>
> test.sikuli:
>
> myScriptPath = "c:\\Sik\\test\\testLIb"
> if not myScriptPath in sys.path: sys.path.append(myScriptPath)
> import testLib
> testLib.testFn()
>
>
> testLib.sikuli:
>
> def testFn():
> testpad = App("calc.exe")
> App.open(testpad)
> popup("Test Fn")
> return()
>
>
>
>
> When the def is in the main sikuli, it works without error.
>
> test2.sikuli:
>
> def testFn():
> testpad = App("calc.exe")
> App.open(testpad)
> popup("Test Fn")
> return()
>
> testFn()
>
>
> Why the error when using an imported sikuli fn?
>
> --
> You received this question notification because you are an answer
> contact for Sikuli.

Can you help with this problem?

Provide an answer of your own, or ask core for more information if necessary.

To post a message you must log in.