Not able to set options dynamically in custom frappe web form


I have a custom web form in which I have set fields dynamically after reading from another doctype. I am rendering the following fields based on the value selected in the current field. This is working fine. But if an initial value1 was selected in lets say field1 and now its changed to value2, so I want to render options in field2 based on this value2. I have tried using frappe.web_form.set_df_property(“field2”, “options”, options2) but this does not render it on the UI.
Please help here.