How can I run an .py file in docker container to let it exit automaticly for Ubuntu?

Now I have a docker image with its os, Ubuntu 16.04. My host OS is also Ubuntu 16.04. Now, I want to make a demo.py file and put it into the docker container. What I want is to let the container exit after I run this demo.py. How can I make it? Is it possible? Thanks!
Here is my toy code, but it failed.

auto_run.py

import os
os.system('exec python test_exit.py')

test_exit.py

import subprocess
def qq():
    while True:
        choice = ""
        choice = input("Type \"quit\" to exit container> ")
        if choice == 'quit':
            print("Exiting container")
            subprocess.call("exit", shell=True)
            break
        else:
            print("Invalid input.")

qq()