While looking stuff about idlelib, I came to this thread in stackoverflow, so I posted own solution. I post it also here, as maybe somebody needs it (as for example \b looks ugly in IDLE)

117 Views
import sys
print('Running IDLE' if 'idlelib.run' in sys.modules else 'Out of IDLE')
About the Author

IT Pro doing Eng-Fin-Eng translations