I want to replace UTextBlock with URichTextBlock in a python script

I want to replace UTextBlock placed in WBP with URichTextBlock in a python script

If I replace it manually, the properties are reset, so I want to automate it. Is there a good way to do this?