Comment Comment by lizard Its notable, perhaps, that the if __name__ == "__main__": block allows you to do this for a _module_, i.e. a single *.py file. If you want to do this for a package, add a `__main__.py`You can also use either of these throughout your code so that you can have python -m foo python -m foo.bar python -m foo.bar.baz each doing different, but hopefully somewhat related, things. parent lizard 3 years ago
You can also use either of these throughout your code so that you can have
each doing different, but hopefully somewhat related, things.