Can I uninstall addon by code?

My purpose is:
1) Remove an addon requirement from "addon.xml"
2) Uninstall another addon.

Is it possible to do that by code?
How can I do each step?

Can you clarify what is the actual use case for this?
This feels like a variation on a question the OP asked in this thread:

There aren't really any specifics there either.
This sounds like the user is trying to get rid of the infamous Indigo addon from the system as it sneaks in as a fake dependency through various dodgy addons
Kodi 19 x64 Windows | CoreELEC 19 S905X

Logout Mark Read Team Forum Stats Members Help
Can I uninstall addon by code?0
This forum uses Lukasz Tkacz MyBB addons.