Is there a possibility to execute a Python script while being in interactive mode February 24, 2023 by Tarik Use execfile('script.py') but it only work on python 2.x, if you are using 3.0 try exec(open('script.py').read())