Attribute "task" and "task action parameters to Action

27 views
Skip to first unread message

QVN

unread,
Mar 29, 2022, 6:21:43 PMMar 29
to python-doit
hi all,

Any way we can use task and paras passing  from the command line to the python action?

def task_py_params():
    def show_params(param1, param2):
        print(param1)
        print(5 + param2)
    return {'actions':[(show_params,)],
            'params':[{'name':'param1',
                       'short':'p',
                       'default':'default value'},

                      {'name':'param2',
                       'long':'param2',
                       'type': int,
                       'default':0}],
            'verbosity':2,
            }


can we pass "task" or  access task in the below func?
 def show_params(param1, param2):
          name = task.name

thx

QVN

unread,
Apr 18, 2022, 2:13:31 PMApr 18
to python-doit

def task_py_params():

    x = "5"

    def show_params(varx, param1, param2, task):
        print(param1)
        print(5 + param2)
    return {'actions':[(show_params,(x, ))],
Reply all
Reply to author
Forward
0 new messages