sikuli import function doesn't work

Asked by Coco.Liu

I have two scripts in the same folder.

#content of script2
from sikuli import *
def mypopup():
    popup("hello, I am script2")

#content of script1
import script2
script2.mypopup()

but after run script1, I got a error:
[error] script [ script1 ] stopped with error in line 2
[error] NameError ( global name 'popup' is not defined )
[error] --- Traceback --- error source first line: module ( function ) statement 3: script2 ( mypopup ) def mypopup():
[error] --- Traceback --- end --------------

Is there any problem in the script?How can I solve this issue?

Question information

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

what version of Sikuli

Revision history for this message
Coco.Liu (musekeke) said :
#2

I use sikuli 1.1.0

Revision history for this message
Coco.Liu (musekeke) said :
#3

Hi Man, thank you for your response. After I restart sikuli, it works~ Maybe I can restart sikuli can solve this problem. ^_^

Revision history for this message
RaiMan (raimund-hocke) said :
#4

read here to understand, what is going on:
http://sikulix-2014.readthedocs.io/en/latest/scripting.html#importing-other-sikuli-scripts-reuse-code-and-images

In version 1.1.1 (http://sikulix.com) the reload is done internally automatically on rerun of the main script.