Adding Custom Card UI Programmatically

I have added entities programmatically via python script. But i can’t add custom card ui for the entity programmatically. Is there any way for that?

Note : I have successfully added custom card UI via Raw Config file. So my only need is to add it programmatically.

Thanks in advance

Hey, I am also looking for this help. Ideally I require entities registered by my custom platform to appear in a different panel with customised card. Now I am able to do everything using ipanel and ui-lovelace.yaml. But this requires user to make the changes which requires some expertise to get the syntax correctly etc.

Looks like homeassistant provides no python helpers for task.
Can someone point out how to approach this.