Within the Python shell if I were to type the following code
import pydoc
pydoc.help(print)
ot would return info on the print function.
Now if I wanted to access this module outside the Python shell, for example in either PowerShell or the Command Prompt in Windows, I would type the following command:
python -m pydoc print
which returns the same info as the previous command that I typed.
Now I understand that within the Python shell that .help is a method of pydoc that I call with a parameter of print. Outside the shell with python -m it's specifying to run a Python module (in this case pydoc).
But what confuses me is how does pydoc know what to do with the print parameter? How does it know which method to use?