Skip to main content
Manu Fernandes
Inspiring
Jun 28, 2023 5:11 AM UTC

U2 Python - PyCallFunction with keyword argument

hello, 

when we define a function like 

def funcname(a,b,c);
    return (a * b + c)

Can we use keyword argument syntax when calling a method/function ? 

like PyCallFunction("module","funcname",a=1,c=2,b=3) 

 or is it mandatory to use positional argument ? PyCallFunction("module","funcname",1, 3, 2) ? 

many thanks



------------------------------
Manu Fernandes
------------------------------

    1 reply

    Manu Fernandes
    Inspiring
    Jun 28, 2023 5:18 AM UTC

    hello, 

    when we define a function like 

    def funcname(a,b,c);
        return (a * b + c)

    Can we use keyword argument syntax when calling a method/function ? 

    like PyCallFunction("module","funcname",a=1,c=2,b=3) 

     or is it mandatory to use positional argument ? PyCallFunction("module","funcname",1, 3, 2) ? 

    many thanks



    ------------------------------
    Manu Fernandes
    ------------------------------

    by the way, can we use dict like this

    items = "{'a': 1, 'b': 2, 'c': 3}"

    PyCallFunction("module","funcname",**items)



    ------------------------------
    Manu Fernandes
    ------------------------------