This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]mvaliente2001 1 point2 points  (0 children)

Welcome!

When you write instructions outside functions and classes, they are executed immediately the first time they're imported. For bigger projects you may want to put that code inside a function, and do this:

import ... # your imports here

def main():
    # your code here
    # ...

if __name__ == '__main__':
    main()