← Back to team overview

sikuli-driver team mailing list archive

Re: [Question #203727]: calling functions between multiple files

 

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

    Status: Open => Answered

RaiMan proposed the following answer:
Running things endlessly is done using a loop, that never ends and has
to be aborted from extern:

while True:
    print "I run endlessly"
    wait(1)

After waiting 1 second it prints again - endlessly.

So with your loop

while runs >= 0:
    main()

you already have your endless repeating of main(): every time you reach
the last line in main(), main is ended and started all over again.

But with your construct, you will 
- start with main()
- call leave
- which calls main()
- which calls leave()
- which calls main()
- ....
and none of these functions will ever be ended, which will lead to an "out of memory" exception after some time. 

So the conclusion:
- to repeat something (even endlessly) we have the looping constructs while and for
- recursive programming (a function calls itself or a function that called it) is a tool to solve complex problems that might iterate many times, but come to an end by itself. These kind of workflows we script with Sikuli do not have these characteristics.

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