← Back to team overview

sikuli-driver team mailing list archive

Re: [Question #144742]: Import for existing scripts doesn't work until re-opening Sikuli

 

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

    Status: Open => Answered

RaiMan proposed the following answer:
ok, then make the following simple test:

-- first .sikuli name it: theLib.sikuli with content:
print "[Info1] this should only be printed once at start up"
def theFunction():
   print "[Info2] Hello, should be printed every time you call me" 

-- second .sikuli name it: theMain.sikuli
import os.path
dir = os.path.dirname(getBundlePath())
if not dir in sys.path: sys.path.append(dir)
from theLib import *
for i in range(3): theFunction()

save both .sikuli in the same directory of your choice.
Restart the IDE.
Run the script theMain.Sikuli in the IDE.
On Rerun, message [Info1] should not come any more, since it only is processed at import.

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