👨🏼‍💻개발/파이썬

파이썬 - 스크립트 파일 실행 도중 인터랙티브 모드로 전환하기

Janger 2023. 7. 29. 11:38
728x90
import code

def interactive_function():
    # 스크립트 실행 중간에 인터랙티브 모드로 전환
    console = code.InteractiveConsole(locals=globals())
    console.interact("인터랙티브 모드로 전환합니다.")

print("스크립트 실행 중...")
# 스크립트 실행 로직

# 중간에 인터랙티브 모드로 전환
interactive_function()
728x90