Use the **kw
call convention:
f = Foo(**settings)
This works on any callable that takes keyword arguments:
def foo(spam='eggs', bar=None):
return spam, bar
arguments = {'spam': 'ham', 'bar': 'baz'}
print foo(**arguments)
or you could just call the function with keyword arguments:
f = Foo(foo="bar")
foo(spam='ham', bar='baz')
Your error is unrelated, you didn't define foo
, you probably meant to make that a string:
settings = {'foo': 'bar'}