Docstring not showing up when importing .py file as a module?

I am working on a project and I am beginning to write functions in other .py files and importing them to the main .py... I want to write help text for the entire file ( module ) that I am importing, similar to when importing a library ( module ) like this:Hovering over tempfile module in vs code

When I try writing something similar at the top of the file I'm importing, the docstring doesn't show up.

Trying this: Attempting to write a docstring in the file I'm importing

But getting this (with no docstring showing): Hovering over the .py file I'm trying to import


  • It is because of your docstring format probably. Try to use such formatting:

    """Helpful docstring for a .py file of functions."""

    Then, if VS Code still doesn't show a docstring when a module hovering, use Reload Window command after saving your file (i. e. Ctrl+Shift+P and enter 'reload window'). You can use pydocstyle linter also. It says, for example, that "One-line docstring should fit on one line with quotes". The linter is supported by Python VS Code extension. But be sure, that python.linting.pydocstyleEnabled option is enabled and pydocstyle is installed itself. You can install it globally or locally for your virtual environment. I prefer the global installation - pip install pydocstyle. Also the extension checks, whether all enabled linters are installed and can help to install them.