Regarding switching between anchor and tag programmatically

Hello! We are using DWM1001C module for our development. Our application requires measuring distance between two modules. Is it possible to achieve this by assigning any one module as anchor and another as tag? If yes, then in case of multiple modules, the modules need to switch their role as anchor and tag programmatically without any manual intervention. How to achieve this?

Regards,