Can't invoke methods(click, hover, .. etc) from another script using IDE

Asked by IvanKovtunov on 2019-01-06

Please, observe my example:

Script1.sikuli contents:

import Script2
Script2.runScript2()

Script2.sikuli contents:

def runScript2():
    print("Try to click")
    click("Screen Shot 2019-01-06 at 18.17.22.png")
    print("DONE")

I run Script1 and get console output:

Try to click
[error] script [ Script1 ] stopped with error in line 2
[error] NameError ( global name 'click' is not defined )

[error] --- Traceback --- error source first
line: module ( function ) statement
3: Script2 ( runScript2 ) click("Screen Shot 2019-01-06 at 18.17.22.png")
[error] --- Traceback --- end --------------

Why global name 'click' is not defined? Can you provide the right way how to run script from another script? Is it possible with IDE to do so? Thanks.

Question information

Language:
English Edit question
Status:
Solved
For:
Sikuli Edit question
Assignee:
No assignee Edit question
Solved by:
RaiMan
Solved:
2019-01-07
Last query:
2019-01-07
Last reply:
2019-01-07
IvanKovtunov (qovtunov) said : #2

Thanks RaiMan, that solved my question.