When you run "python" in your terminal, you get a running instance of python where you can run python code.

I want to do this, but after my script has run a few functions first.

[![enter image description here](https://i.stack.imgur.com/kYXxK.png)](https://i.stack.imgur.com/kYXxK.png)

But what I want is this type of interface at the end of my script.

[![enter image description here](https://i.stack.imgur.com/rUAN0.png)](https://i.stack.imgur.com/rUAN0.png)

I.e. I want to run my\_script.py, in "main" call a few functions, but then after those functions, keep the "workspace" open with the >>> interface so that the user can run more python code.

```
if __name__ == "__main__":

    excel_file = sys.argv[1]
    my_list = load_file(excel_file) 
    #... do a bunch of other things

    # open python interface now >>>
    while True:
        # accept user python commands like in the terminal example above

```

Is there any way to do this?