Run script when switching to current tty session

Let's say I have a user in tty2 (with xorg environment). If I change the session with the shortcut (Ctrl + Alt + Fn) and change back to tty2, I would like to run a script (for the user of this session). Is this possible to do?