I've created a Python module from Fortran files with:
f2py -c -m mymod file1.f90 file2.f90 file3.f90
file1.f90
contains Fortran modules: foo
, bar
, bar
.
Module foo
contains functions: f
,g
,h
.
f2py automatically write docstring for function f
.
mymod.so
is contained in directory ROOT
, and I've added ROOT
in my PYTHONPATH
.
I can access docstring of f
function with:
import mymod
mymod.foo.f.__doc__
I now want write documenation for function f
using autodoc extension of sphinx:
.. autofunction:: mymod.foo.f
But it fails with:
ImportError: No module named mymod.foo
I think sphinx is trying to import like this, which does not work:
import mymod.foo
foo.f.__doc__
I tried to import a package containing __init__.py
.
How can I make sphinx find mymod.foo.f
doctring?