Put the code inside a function and it won't run until you call the function. You should have a main function in your main.py
. with the statement:
if __name__ == '__main__':
main()
Then, if you call python main.py
the main()
function will run. If you import main.py
, it will not. Also, you should probably rename main.py
to something else for clarity's sake.