【发布时间】:2013-08-21 11:30:06
【问题描述】:
我编写了一个名为 myFunction 的小 Python 函数,存储在我想在 conf.py 文件中调用的 function.py 中。从测试 python 文件调用该函数时,该函数工作正常,因此我似乎在此文件中专门导入模块时遇到问题。
设置是这样的:
DocumentSourceFolder/sourcefile.txt
DocumentSourceFolder/conf.py
DocumentSourceFolder/function.py
在 conf.py 中我添加了以下内容:
import function
variable = function.myFunction()
(其中变量是 conf.py 文件中已经存在的东西)。
但是,在此文档上运行 sphinx 时,我收到错误:
ImportError: No module named function
有什么想法吗?
谢谢
【问题讨论】:
标签: python import python-sphinx