From the course: Python Theory for Network Engineers

Unlock the full course today

Join today to access over 24,700 courses taught by industry experts.

Python packages

Python packages

- [Instructor] Suppose we have developed a very large application that involves multiple modules and it became very difficult to maintain, is there a way to organize them even more? Yes, we could organize multiple modules into packages. So the way that we could think of package is basically we could create a new folder with the package name and use the same dot notation to refer to them. What we would do is create a init double under init.py file in that folder in order for Python to recognize it as a package. This dunder init.py file could be empty and it is run when the package or a module inside that package is imported. So if there's anything you want to run, make sure that's run every time this package is invoked. Then you want to put into that init.py file. I also want to point out, when I first started learning Python and a lot of the documentation out there specify that this dunder init. file is required which is…

Contents