In simple words, a python module contains functions and statements. A module can contain many elements or define functions, classes, executable code, and variables as well. A module can help you to keep the related code collectively in some place. In logical aspects as also you can keep your code organized. If you use any editors and shell, there will be some modules that are available by default or in-built. So, we are going to look at many ways to get the list of python modules. Let’s roll!!!
Creating a simple python module
Creating a python module is very easy. As discussed above, in a module you can define functions, classes, and even variables. You have to write the function or runnable code, save the file with .py extension, import, and use it in code. As simple as that.
def welcome_message(name): print("Howdy" + name)
Well, we have defined a function that greets the input name. We have to save the file as a .py extension. In this case, we are going to save it as mymodule.py. Now we can import the module and call the function.
import mymodule mymodule.welcome_message("Hackanons")
Howdy, Hackanons
Get list of modules in python (In-built)
Creating a module is easy as shown above. But python offers plenty of most useful modules for your coding purposes. If you want to know what are modules that python offers for you, you can run the below code to get the list of modules in python.
help('modules')
Cython brain_random mailcap sndhdr
IPython brain_re markupsafe snowballstemmer
OpenSSL brain_responses marshal socket
PIL brain_scipy_signal math socketserver
PyQt5 brain_six matplotlib socks
__future__ brain_sqlalchemy mccabe sockshandler
_abc brain_ssl menuinst sortedcollections
_ast brain_subprocess mimetypes sortedcontainers
_asyncio brain_threading mistune soupsieve
_bisect brain_type mkl sphinx
_black_version brain_typing mkl_fft sphinxcontrib
_blake2 brain_uuid mkl_random spyder
_bootlocale brotli mmap spyder_kernels
_bz2 bs4 mmapfile sqlalchemy
_cffi_backend builtins mmsystem sqlite3
_codecs bz2 mock sre_compile
_codecs_cn cProfile modulefinder sre_constants
_codecs_hk calendar more_itertools sre_parse
_codecs_iso2022 certifi mpmath ssl
_codecs_jp cffi msgpack sspi
_codecs_kr cgi msilib sspicon
_codecs_tw cgitb msvcrt stat
_collections chardet multipledispatch statistics
_collections_abc chunk multiprocessing statsmodels
_compat_pickle click mymodule storemagic
_compression cloudpickle mypy_extensions string
_contextvars clyent nacl stringprep
_csv cmath navigator_updater struct
_ctypes cmd nbclient subprocess
_ctypes_test code nbconvert sunau
_datetime codecs nbformat symbol
_decimal codeop nest_asyncio sympy
_distutils_hack collections netbios sympyprinting
_dummy_thread colorama netrc symtable
_elementtree colorsys networkx sys
_functools commctrl nltk sysconfig
_hashlib compileall nntplib tables
_heapq comtypes nose tabnanny
_imp concurrent notebook tarfile
_io conda nt tblib
_json conda_build ntpath telnetlib
_locale conda_env ntsecuritycon tempfile
_lsprof conda_package_handling nturl2path terminado
_lzma conda_verify numba test
_markupbase configparser numbers test_data
_md5 contextlib numexpr test_pycosat
_msi contextlib2 numpy testpath
_multibytecodec contextvars numpydoc tests
_multiprocessing copy odbc textdistance
_nsis copyreg olefile textwrap
_opcode crypt opcode this
_operator cryptography openpyxl threading
_osx_support csv operator threadpoolctl
_overlapped ctypes optparse three_merge
_pickle curl os tifffile
_py_abc curses packaging time
_pydecimal cwp pandas timeit
_pyio cycler pandocfilters timer
_pyrsistent_version cython paramiko tkinter
_pytest cythonmagic parser tlz
_queue cytoolz parso token
_random dask partd tokenize
_sha1 dataclasses past toml
_sha256 datetime path toolz
_sha3 dateutil pathlib tornado
_sha512 dbi pathlib2 tqdm
_signal dbm pathspec trace
_sitebuiltins dde pathtools traceback
_socket decimal patsy tracemalloc
_sqlite3 decorator pdb traitlets
_sre defusedxml pep8 tty
_ssl diff_match_patch perfmon turtle
_stat difflib pexpect turtledemo
_statistics dis pickle typed_ast
_string distributed pickleshare types
_strptime distutils pickletools typing
_struct doctest pip typing_extensions
_symtable docutils pipes ujson
_system_path dummy_threading pkg_resources unicodecsv
_testbuffer email pkginfo unicodedata
_testcapi encodings pkgutil unittest
_testconsole ensurepip platform urllib
_testimportmultiple entrypoints plistlib urllib3
_testinternalcapi enum pluggy uu
_testmultiphase erfa ply uuid
_thread errno poplib venv
_threading_local et_xmlfile posixpath warnings
_tkinter fastcache pprint watchdog
_tracemalloc faulthandler profile wave
_warnings filecmp prometheus_client wcwidth
_weakref fileinput prompt_toolkit weakref
_weakrefset filelock pstats webbrowser
_win32sysloader flake8 psutil webencodings
_winapi flask pty werkzeug
_winxptheme fnmatch ptyprocess wheel
_xxsubinterpreters formatter pvectorc widgetsnbextension
_yaml fractions py win2kras
abc fsspec py_compile win32api
adodbapi ftplib pyclbr win32clipboard
afxres functools pycodestyle win32com
aifc future pycosat win32con
alabaster gc pycparser win32console
anaconda_navigator genericpath pycurl win32cred
anaconda_project getopt pydoc win32crypt
antigravity getpass pydoc_data win32cryptcon
appdirs gettext pydocstyle win32ctypes
argh gevent pyexpat win32event
argon2 glob pyflakes win32evtlog
argparse glob2 pygments win32evtlogutil
array gmpy2 pylab win32file
asn1crypto greenlet pylint win32gui
ast gzip pyls win32gui_struct
astroid h5py pyls_black win32help
astropy hashlib pyls_jsonrpc win32inet
async_generator heapdict pyls_spyder win32inetcon
asynchat heapq pyodbc win32job
asyncio hmac pyparsing win32lz
asyncore html pyreadline win32net
atexit html5lib pyrsistent win32netcon
atomicwrites http pytest win32pdh
attr idlelib pythoncom win32pdhquery
audioop idna pytz win32pdhutil
autopep8 imageio pywin win32pipe
autoreload imagesize pywin32_bootstrap win32print
babel imaplib pywin32_testutil win32process
backcall imghdr pywintypes win32profile
backports imp pywt win32ras
base64 importlib pyximport win32rcparser
bcrypt importlib_metadata qdarkstyle win32security
bdb iniconfig qtawesome win32service
binascii inspect qtconsole win32serviceutil
binhex intervaltree qtpy win32timezone
binstar_client io queue win32trace
bisect ipaddress quopri win32traceutil
bitarray ipykernel random win32transaction
bkcharts ipykernel_launcher rasutil win32ts
black ipython_genutils re win32ui
blackd ipywidgets readline win32uiole
bleach isapi regcheck win32verstamp
blib2to3 isort regex win32wnet
That’s it. The help command will get list of python module which are available to you to use in the code.
List of python modules in Conda environment
Do you use Anaconda navigator? If yes, then you have to open the conda prompt and then run the “conda list” command to get the list of available modules in python.
conda list

With the help of “conda list” command, you will get the list of modules with their current version and build information.
Benefits of Python modules
- You can create a logically organized code with all related functions and statements in one file i.e. module.
- It will increase the readability of the code for easy understanding.
- The defined function can reusable when needed.
- It will help to avoid the duplicity of the code.
Wrapping Up
Python by default offers many modules for your coding journey. You can easily create your custom modules based on your requirements. If you want, you can get the list of python modules with the help of code as shown above. You can use different methods as illustrated in this article. Happy python!!!.