← Back to team overview

sikuli-driver team mailing list archive

Re: [Question #251206]: pause sikuli until another finish

 

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

    Status: Open => Answered

RaiMan proposed the following answer:
if you know the places, where the second scipt should run, the the
easiest (and fastest) way is to put the complete code of the second
script into a def (function) and call it when needed.

# second script now:
click()
wait
# and more

# second script as def (named second.sikuli)
from sikuli import *
def runScript():
    click()
    wait()
    # and more

as you can see, after the def line all lines have to be indented once (select all lines and press tab)
see faq 1800 about indentation

# your first script now:
import second
# now your existing code
second.runScript() # this will execute your second code and come back when finished

Take care: all images in both scripts must have different filenames if
they are different (no problem if you leave the automatic naming as
timestamp)

about this solution:
http://sikulix-2014.readthedocs.org/en/latest/globals.html#importing-other-sikuli-scripts-reuse-code-and-images
especially: use reload() if you are changing second in IDE while running the main script in the same IDE session.

-- 
You received this question notification because you are a member of
Sikuli Drivers, which is an answer contact for Sikuli.