With some helpful discussions from the folks in the comments and this similar question, I believe I have found a solution (perhaps not the best solution).
In the src/lib_name/__init__.py
file, if I include:
import lib_name.lib_name
from . import file1, file2
Then in a Jupyter notebook, I import the lib as follows:
from lib_name.lib_name import func
func() # Call the function.
This seems to resolve the name space error I mentioned above.
However, what I still don't understand:
lib_name.lib_name
? Unless I've misunderstood, I thought the src
layout allowed you so only need to call lib_name
once?lib_name
. Why is this? Again, I was of the understanding this could be done with just one import with src
layout.__init__.py
file, can I not import all the modules in one line? E.g., from . import lib_name, file1, file2
Any insights on these questions, or recommendations on improving the answer, would still be greatly appreciated.