I'm running into a lot of trouble trying to use Sphinx autodoc for a python package, and I think the issue is a path one, but I'm not sure how to solve? Wondering if anyone might know?
I'm trying it out with just a super basic module setup with a single main.py inside of 'my_project' that looks like:

In both cases below, I have just a basic conf.py and index.rst file:

Scenario 1 (works fine)
When I use the sphinx-quickstart command to build out the folder tree and specify 'N' when asks if I want to separate source and build directories, it seems to all work fine and I am able to successfully build the html and it finds and reads my_project.main without issue. In this case, I get a folder tree that looks like:
.
├── docs
│ ├── build
│ ├──_static
│ ├──_templates
│ ├──conf.py
│ └──index.rst
└── my_project
└── main
Scenario 2 (not working)
However: When I use the sphinx-quickstart command to build out the folder tree and specify 'Y' when it asks about separating source and build, now I get a nicer more ordered folder tree within my ./docs. So now I have:
.
├── docs
│ ├── build
│ └── source
│ ├──_static
│ ├──_templates
│ ├──conf.py
│ └──index.rst
└── my_project
└── main
But the nesting of the conf.py (I think?) seems to be causing path trouble? Now if I try and build the html, I get an import error:
WARNING: autodoc: failed to import module 'main' from module 'my_project';
the following exception was raised:
No module named 'my_project'
So it seems that the conf.py is not probably finding and adding the top-level path in this case?
So, I wonder:
- How can I add a folder 2 levels 'up' from current to the sys.path? I can get one level 'up' using
..but...does not work to go up two? It does not work when I try something like:sys.path.insert(0, os.path.abspath('...')) # three dots does doesn't work? - Am I missing something else here? how should I be using the 'nested' sphinx-quickstart setup to properly find my modules using autodoc?