Sphinx linking functions between files

485 views Asked by At

I've been looking for an answer on stackoverflow and in official docs and still can't find the solution.

In the main Sphinx-doc document I have:

Contents:

.. toctree::

    views/index.rst
    db/index.rst

In views/index.rst

.. py:currentmodule:: app.views
.. py:function:: create_user

  this function uses create_user_db

and in db/index.rst

.. py:currentmodule:: app.db

.. py:function:: create_user_db
   this function creates the user in database

What I need is a hyperlink from create_user to exacly the place create_user_db is.

Functions are not genereated by autodoc, I don't want to use sections and *.. _section_label :* for every function that is listed in db/index.

Is it even possible to link it that way that views can move you to db/index.html#app.db.create_user_db using :doc:, :ref: or something?

1

There are 1 answers

1
mzjn On BEST ANSWER

This should work:

this function uses :py:func:`app.db.create_user_db`

You need to use the fully qualified name.