On 5/24/2016 9:02 PM, Steven D'Aprano wrote:
On Wed, 25 May 2016 09:35 am, Gerald Britton wrote:
For brevity, here's your package setup:
testpkg/
+-- __init__.py
+-- testimport.py which runs "from testpkg.testimported import A"
+-- testimported.py containing class A
Your package layout is correct. But:
I have a similar setup, except with multiple files importing from
imported file. One way to make absolute imports within a package work,
and how I do it, is to put the directory containing testpkg in a .pth
file in the site-modules directory. In particular, I have python.pth
containing "F:/Python". This effectively makes "Python" an extension of
'site-packages', so when site-packages is searched for modules, so is
Python.
--
Terry Jan Reedy
--
https://mail.python.org/mailman/listinfo/python-list