Skip to content

Types of modules in Python | Basics

  • by

Python has a lot of inbuilt modules but if you want to categorize it then there are three main types of modules in Python:

  • Built-in Modules: Python Standard Library (math module)
  • External Modules: Installed using pip, Python’s package management tool.
  • User-Defined Modules: Files containing functions, variables, etc defined by the developer in your Python program.

Complete list:-

Most used types of modules in Python

These Python packages every developer should know and learn:

  1. NumPy – Basic mathematical operations without any special Python packages.
  2. Pendulum
  3. Python Imaging Library. …
  4. MoviePy. …
  5. Requests. …
  6. Tkinter. …
  7. PyQt. …
  8. Pandas.
  9. Pywin32
  10. Pytest

Custome module example in Python

You can make your own modules and use them. it will help to easily understand code and increase code reusability.

Create: Save this code in a file named

var = "Hello main file"
num = 9876543210

def greeting(name):
    print("Hello, " + name)

Import and use: Just use the import statement

import main



Types of modules in Python

How many types of modules are there in Python?

Answer: The Python standard library has almost 200 modules, although the exact number varies between distributions.

Do comment if you have any doubts or suggestions on this Python modules tutorial.

Note: IDE: PyCharm 2021.3.3 (Community Edition)

Windows 10

Python 3.10.1

All Python Examples are in Python 3, so Maybe its different from python 2 or upgraded versions.

Leave a Reply

Discover more from Tutorial

Subscribe now to keep reading and get access to the full archive.

Continue reading