How-to articles, tricks, and solutions about MODULE

How do I get a list of locally installed Python modules?

You can use the pip module to get a list of locally installed Python modules.

How do I unload (reload) a Python module?

To unload a Python module, you can use the del statement to remove it from memory.

How to install bcmath module?

The bcmath extension is typically installed by default in most PHP installations.

How to list all functions in a module?

To list all functions in a module, you can use the dir() function to get a list of all the names defined in the module, and then use the inspect module to check if each name is a function.

How to retrieve a module's path?

You can use the __file__ attribute of a module to retrieve its path.

Importing modules from parent folder

In Python, you can use the sys.path.append() method to add the parent directory to the list of paths where Python looks for modules.

What is __init__.py for?

__init__.py is a special Python file that is used to indicate that the directory it is present in is a Python package.