How to call a function from another function of sam class

Asked by Harry

Following is my code snipet. Please help me out:-

from sikuli import *
import comres # used for var inv_no

class phonevalidation:
    def blank_number(self):
        wait(1)
        click("1405933572316.png")
        while not exists("1405933601065.png",0):
            wait(1)
        click("1405933623586.png")

    def invalid_number(self,inv_no):
        wait(2)
        type(inv_no)
        wait(4)
        self.blank_number() #even tried phonevalidation.blank_number(). It is throwing error as "blank_number is not defined"

        while not exists("1405931822646.png",0):
            type(Key.BACKSPACE)

Calling from main:
phn=phonevalidation()
phn.blank_number()

Question information

Language:
English Edit question
Status:
Solved
For:
SikuliX Edit question
Assignee:
No assignee Edit question
Solved by:
Harry
Solved:
Last query:
Last reply:
Revision history for this message
RaiMan (raimund-hocke) said :
#1

I cannot reproduce any problem with your class definition.

So it does not seem to be the whole picture:
you are talking about main: what is imported there?
"blank_number is not defined" cannot be thrown inside invalid_number, since it is not called in your snippet.

Revision history for this message
Harry (iam-harishetty) said :
#2

Raiman, It was an intermittent issue becoz it worked for me know. I just closed the ide and re-lauched it and run the code.

Thanks for help

Revision history for this message
Harry (iam-harishetty) said :
#3

how to use function of one class in other class