← Back to team overview

sikuli-driver team mailing list archive

Re: [Question #651217]: How to call a function from other module

 

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

    Status: Open => Answered

RaiMan proposed the following answer:
script code at indent level 0 (function1()
function2() in script2 in this case) is executed at import time.

so script2 should only be:
from sikuli import *

def function1(): #
    popup("hello, I am script2, function1")

def function2():
    popup("hello, I am script2, function2")

... and script1 can either be
import Script2
popup("hello, I am script1")
Script2.function2()

... or
... and script1 can either be
from Script2 import *
popup("hello, I am script1")
function2()

... in the second case it might come to name clashes.

-- 
You received this question notification because your team Sikuli Drivers
is an answer contact for Sikuli.