Dynamic variable name/function name

Asked by Itzik Gar

Hi,

Can you please advise if it is possible to create function name with dynamic name?
for example, I would like to create a loop that clicks 1-9 on calculation, for each click I created a function and I would like to call them one by one using a loop.

#function
num = '1'
def press + num():
    click("1485207960066.png")

#loop
while num < 10
        press + num()
          num ++

something like that...

Question information

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

a function can have parameters, which would be the solution for your problem:
one function that is used with different parameters (the numbers 1 - 9 in your case).

This is Python base knowledge - so in doubt consult appropriate Python docs and/or tutorials.

Can you help with this problem?

Provide an answer of your own, or ask Itzik Gar for more information if necessary.

To post a message you must log in.