try:
    ic.interact('My custom console banner!')
except SystemExit as e:
    print('Got SystemExit!')
shared_var
shared_var = 'Set in sub-console'
sys.exit()
shared_var
Скрипт внутри приложения Python