Hello! is there a way to use **kwargs with the pr...
# prefect-community
s
Hello! is there a way to use **kwargs with the prefect map function as per the below?
Copy code
changes = generator_task.map(
                sim, 
                unmapped(x), 
                unmapped(y),
                unmapped(z),
                **kwargs #need this unmapped
            )
j
Hi Sanjay.
kwargs
should work fine, but you may need to wrap them in
unmapped
as well. Are you seeing an issue?
s
yes, where does the unmapped wrap around it? these two don't work
unmapped(**kwargs)
**unmapped(kwargs)
by the way, thank you for the super quick reply
j
you'd need to wrap each of the values in
**kwargs
in unmapped. The following should work:
Copy code
task.map(..., **{k: unmapped(v) for k, v in kwargs.items()})
I'd probably break that into multiple lines for readability:
Copy code
unmapped_kwargs = {k: unmapped(v) for k, v in kwargs.items()}
task.map(..., **unmapped_kwargs)
s
Thank you so much! that worked
j
Glad to hear it! Please let us know if you run into any other issues.