Tracking switching between View Layers
The Blender Python API does not provide a special handlers for tracking View Layers switching. However, if it needs to perform some action when switching them, we can track their switching using the message bus.