I'm just learning about **kwargs and I'm probably twisting up it's real use, so here goes...
I have 1 main script, 3 functions and a dict: script.py, setup(), billing(), newCust(), data = {}
setup() will call billing() and billing() will call newCust(), and newCust will return an id that will be used as setup() continues.
each function will accept optional named params, **kwargs, which is the dict, data = {}
im simply passing the dict along through the functions until it hits newCust(), where I manipulate the data and desire to return some other data. but it seems that newCust() is unable to return its data, when assigned to a variable. the data has been passing along fine.
def setup(**kwargs):
id = billing(**kwargs)
analytics(id)
......
def newCust(**kwargs):
username = kwargs.get("ok",None)
id = callapi(username)
return id
def billing(**kwargs):
id = newCust(**kwargs)
return id
......
#calling the setup function which will begin passing the data along
data = {'ok':1, 'okk':2, 'okkk':3}
setup(**data)