sikuli-driver team mailing list archive
-
sikuli-driver team
-
Mailing list archive
-
Message #17061
[Question #224366]: Reuse of code through import
New question #224366 on Sikuli:
https://answers.launchpad.net/sikuli/+question/224366
Hello,
I have several primary scripts, portions of which repeat many times from script to script. I want to modularize the repetitive portions, turn them into their own individual scripts, and then call them from the primary scripts. The obvious benefit is to make the code more flexible, more efficient and easier to maintion.
But...
I am having difficulty implementing what I think should be a fairly easy programming concept. Below is a sample of what I'm generally trying to do using the import function. In this case, I have a main script which calls a sub-script, and then goes into a loop which includes calling to other sub-scripts.
The behavior I'm observing is that sub-script b goes into a loop. I was expecting sub-script b to complete and then execute the next line of code in the main script.
I hope this provides enough details to communicate the essence of my problem. Thanks in advance for any assistance.
Main_Script
#<start>
Sub_Script_C
for x in xrange(0,100):
Click(some image)
Type(some text)
Etc...
import Sub_Script_B
reload(Sub_Script_B)
Click(some image)
Type(some text)
Etc...
import Sub_Script_C
reload(Sub_Script_C)
Click(some image)
Type(some text)
Etc...
#<end>
Sub_Script_A
#<start>
from sikuli import *
Click(some image)
Type(some text)
Etc...
#<end>
Sub_Script_B
#<start>
from sikuli import *
Click(some image)
Type(some text)
Etc...
#<end>
Sub_Script_C
#<start>
from sikuli import *
Click(some image)
Type(some text)
Etc...
#<end>
--
You received this question notification because you are a member of
Sikuli Drivers, which is an answer contact for Sikuli.