I have a Python function that takes one required parameter and four optional ones. If an optional param has no value it needs to be omitted from the call to the function. An example call will be like the following with all params specified.
MyFunction(required='Delta', param1='ABC', param2='XYZ', ID=1234, title='Imp Info')
I would like to gather all of my optional params into a variable and then pass a variable into the function. This will make handling the optional params easier. Something like the following:
myVar = "param2='XYZ', ID=1234, title='Imp Info'"
MyFunction(param1='Delta', myVar)
I've tried the above but it failed with a syntax error. How can I pass function params as a variable? I appreciate any guidance.
MyFunction(required, **kwargs), use a dict of kwargs...