I have the following folder structure for a package project (simplified):
projectname
├── docs
├── packagename
│ ├── somemodule
│ | ├── __init__.py (second)
| │ └── somescript.py
│ └── __init__.py (first)
├── setup.cfg
└── pyproject.toml
In first __init__.py I do from . import somemodule. In the second __init__.py I do from .somescript import *. And somescript.py contains some function my_sum. The problem is that sphinx doesn't see the function. It only sees module packagename.somemodule - there is no function doscstring for my_sum in generated documentation. The function works well if I install the library using pip install . from the projectname folder.
I'm sure the problem is in the folder structure or imports because there was no problem when somescript.py was placed directly in packagename folder.
Additional information (maybe useful, maybe not):
I use Read The Docs.
Part of .readthedocs.yaml:
python:
install:
- method: pip
path: .
UPD:
Read The Docs generates the following warnings:
WARNING: autodoc: failed to import module 'somescript' from module 'packagename'; the following exception was raised:
No module named 'packagename.somescripts'
WARNING: html_static_path entry '_static' does not exist
UPD2:
I fixed the warning from autodoc by fixing docs/source/packagename.rst but I still have the problem