sikuli-driver team mailing list archive
-
sikuli-driver team
-
Mailing list archive
-
Message #34444
Re: [Question #271020]: Problem with reload function?
Question #271020 on Sikuli changed:
https://answers.launchpad.net/sikuli/+question/271020
Status: Open => Answered
RaiMan proposed the following answer:
- an imported script should have only definitions (def(), class(), ...) and may be initialising code if needed.
All code on indent level 0 is executed on import and on reload().
- the normal setup and usage of imported stuff is like this:
#Script1
from sikuli import *
def function1():
..
def function2()
..
#In script 2
import script1 # nothing is executed
reload(script1) # nothing is executed
...
script1.function1() # executes function1()
...
script1.function2() # executes function2()
-- if you want to tell script1 functions some variables, define them as
parameters
#Script1
from sikuli import *
def function1(varyingImage):
find(varyingImage)
..
#In script 2
import script1 # nothing is executed
reload(script1) # nothing is executed
...
img1 = "someImage.png"
script1.function1(img1) # executes function1() with image img1
...
img2 = "someOtherImage.png"
script1.function1(img2) # executes function1() with image img2
You received this question notification because your team Sikuli Drivers
is an answer contact for Sikuli.