How can we add a new object in a menu only when a specific session is running

[original thread by Nitika Sharma]

The underlying command should implement isVisible callback.