Feb-02-2020, 06:55 PM
Hello
Suppose you have this folder and file structure
Now suppose you try the following in somemodule.py:
The following does work however:
Thanks
Peter
Suppose you have this folder and file structure
/ProjectDir /library1 utils.py somemodule.py /utils helper.pyWhere in helper.py you have a class called XYZ.
Now suppose you try the following in somemodule.py:
from utils.helper import XYZan error will be thrown. Not terribly surprisingly this is due to the fact that python seems to be looking in utils.py, rather the utils folder.
The following does work however:
import imp helper = imp.load_source('helper', './utils/helper.py')so I figure that the files and folders are named poorly. Is there any other way though other than using imp to import from helper.py?
Thanks
Peter