Use \”__main__\” in Python to make packages runnable

Overview

Python packages are typically things you pip install and run by importing into your code. But you can make packages runnable from the Python command line using the "-m" option — and by configuring your package with a "main" module. This video steps you through the basics of using "main" in a package, and how it differs from "init" in a package (and elsewhere, too).

Register Now

  翻译: