Dynamically assign keywords when using annnotate_rows()

I am attempting to annotate rows in a matrix table using a large number of annotations. In order to do this I am looping through a set of numbered annotations. I am running into an issue where I’d like to be able to assign keywords for these annotations dynamically when using mt.annotate_rows(), for example:

for i in range(1, 101):
an_table = hl.import_bed(“an”+str(i)+".bed.bgz")
mt = mt.annotate_rows(‘AN_’+str(i) = an_table[mt.locus][‘target’])

However I get the error:

keyword can’t be an expression

Is there a way to dynamically assign keywords using a e.g. a string expression? Thank you for any insight.

keyword args in Python can be passed as a dictionary using **:

>>> def foo(**kwargs):

>>> foo(a=5, b=7)
{'a': 5, 'b': 7}

>>> foo(**{'a': 5, 'b': 7})
{'a': 5, 'b': 7}

need to put this in the docs.

This answered my question perfectly, thank you! I learned something new about python too!