Error with python reticulate

Hello everyone!
I would like to add my proper color palette from R to the uns[‘leiden_colors’] but… I have an error.
The similar operation can be done with the obs[‘groups’] without error.

Have you an idea please ?

You could use py_set_item. uns is a dictionary while obs is a pandas dataframe.
I guess there is a difference how they can be addressed.

color <- c('red', 'blue', 'green')
py_set_item(adata$uns, 'leiden', color)
# [1] "red" "blue" "green"