Change module event

Hi all

I would like to make some function which operates when the module is changed.
(I don’t want to use .slicerrc.py)

Could you give me some tips to implement this ?

Each module has an enter method where it can do things. Or you can use slicer.util.moduleSelector and connect to the moduleSelected signal.

Like this:

slicer.util.moduleSelector().connect('moduleSelected(QString)', print)