From a .sikuli how to call a parameterized method available in a different .sikuli.

Asked by Garima Kumar

Hello team,
i am trying to call an parameterized method available in a different .sikuli folder.
i am able to call a non parameterized but not the parameterized one.
Please guide me how to do the same.

Thanks And Regards
Garima

Question information

Language:
English Edit question
Status:
Solved
For:
SikuliX Edit question
Assignee:
No assignee Edit question
Solved by:
Garima Kumar
Solved:
Last query:
Last reply:
Revision history for this message
Eugene S (shragovich) said :
#1

Hi Garima,

Can you please provide a bit more information on how are you attempting to do that?

Thanks,
Eugene

Revision history for this message
Garima Kumar (garima-bit-mca) said :
#2

Hello,

I have a workflow.sikuli, inside that ia have a method called
def createWorkflow(workflowName):
    print "method called from workflow.sikuli"
    print workflowName

Now in some other callingWorkflowCreation.sikuli code
import workflow
createWorkflow(workflowName = "Cardiac")
print "back to callingWorkflowCreation.sikuli"

i am expecting the result shuld be
"method called from workflow.sikuli
Cardiac
back to callingWorkflowCreation.sikuli"

Revision history for this message
obiwan-92 (obiwan-92) said :
#3

Hello.

Replace
createWorkflow(workflowName = "Cardiac")
by
createWorkflow("Cardiac").

It should be work better.

Regards.

Revision history for this message
Garima Kumar (garima-bit-mca) said :
#4

Hello Obiwan,
thanks for the reply,with createWorkflow("Cardiac"). it's working fine.
but now one more error came into picture, i am passeing an image's path like "E:\Repository\PatientName.png".
this name is passed to the method, but at the time to check for the existence of this image on screen, it's failing.
i am using this image in method like
lib.sikuli
def myMethod(patientName):
    if exists(patientName)
        click("E:\Repository\seriesButton.png")

callee.sikuli
import lib
lib myMethod("E:\Repository\PatientName.png")

got an error
[error] NameError (global name 'exists' es not defined)

Regards
Garima

Revision history for this message
obiwan-92 (obiwan-92) said :
#5

Ok.

I see a lot of errors, here.

1. At the beginning of the imported file, add : from sikuli import *
2. Replace if exists(patientName) by if exists(patientName):
3. The image have to be in the sikuli folder or the sikuli folder should be add to sys.path

Maybe, you have some other errors.

Regards.

Revision history for this message
Garima Kumar (garima-bit-mca) said :
#6

hello Obiwan

i m missing point 1 so it has solved my problem.
point 2 is my typo mistake while writting the question.
point 3 need i am not finding in my scanerio.

thanks for solving my problem. :)