← Back to team overview

sikuli-driver team mailing list archive

Re: [Question #238124]: Need sample of script with imported sub-scripts

 

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

    Status: Answered => Open

tjonnyc is still having a problem:
...whoa.

That's a bit more complicated than I expected, but I'll play around with
it.

To possibly simplify the situation: I don't need to concurrently edit
scripts in the IDE, or change them at run-time. I want to develop mini
"modules" that accomplish some simple task, and be able to call them
from the "main" script

Here's what I have now:

Item1 = Location(xxx,yyy)
Item2 = Location(xxx,yyy)
...
Item300 = Location(xxx,yyy)

def SomethingToDo1(n):
    {code}
def SomethingElseToDo2(n):
    {code}
....1200 lines later (I'm not kidding)...
def OneMoreThingToDo(n):
    {code}
-------
for a in range(1):
    SomethingToDo(a)
    SomethingElseToDo(a)
    ....
    OneMoreThingToDo(a)

=========================================

Here's what I would like to have instead:

Import Coordinates.sikuli   <---- this would have 400+ lines of coordinate definitions
Import SomethingToDo.sikuli
Import SomethingElseToDo.sikuli
Import OneMoreThingToDo.sikuli

for a in range(1):
    SomethingToDo(a)
    SomethingElseToDo(a)
    OneMoreThingToDo(a)

=========================================

Can you give me a simple example of something like this?

I can unit-test and edit the sub-scripts individually, it's not a
problem. Just can't seem to get the import thing to work properly.

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