Defnition calling another Definition already declared.

Asked by Leonardo Castro

Hello.

I'm tryng to call one definition already defined, inside another definition.

CODE:

def teste1(event):
     popup("teste 1")

def teste2(event):
     popup("teste 2")

def teste3(event):
     popup("teste 3")

def all(event):
    teste1()
    teste2()
    teste3()

all()

Question information

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

if a def() is defined with a positional parameter, it MUST be given when called.

This is a variant using keyword arguments:

def teste1(event = None):
  if not event:
     popup("teste 1")

def teste2(event = None):
  if not event:
     popup("teste 2")

def teste3(event = None):
  if not event:
     popup("teste 3")

def all(event = None):
  if not event:
    teste1()
    teste2()
    teste3()

all()

Revision history for this message
Leonardo Castro (leokastro) said :
#2

Thank you Raiman!