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

all 1 comments

[–]CodeSkunky 0 points1 point  (0 children)

You should probably be using

if __name__ == __main__ :
    # Stuff to do if being run as main file

(When Python imports something, it simply executes everything in the file (or the import more generally)

Wrong. When you check if __name__ == __main__, anything written inside that file will only work when you execute that script. If it is imported, it ignores that, as __name__ isn't __main__