← Back to team overview

sikuli-driver team mailing list archive

Re: [Question #178370]: how to call/import a function in one script to another script

 

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

    Status: Open => Answered

RaiMan proposed the following answer:
the basic template is (it is Sikuli's extension of the standard Python
import):

*** main.sikuli
from sub import *
# using/call
myFunction()

*** sub.sikuli
# mandatory if Sikuli features are used here
from sikuli import *

def myFunction():
     popup("hello from myFunction")

this works as is, if the two scripts are in the same directory.
all images in main and sub are accessible automagically.

for more information: http://sikuli.org/docx/globals.html#importing-
other-sikuli-scripts-reuse-code-and-images

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