remove list of widget in viewport

how to remove a specific list of widget in a viewport . like for example i have widget 1 , widget 2, …which i need to clear but other main widget retain.
because it overlaps on the viewport


That looks right to me. But why do you set 'New Var5" and then removing it?

Removing a widget is as simple as referencing it and removing it from parent

Just make sure Widget 2 and Widget 1 is set before calling the remove function and it should work just fine.