By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
439,932 Members | 1,908 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 439,932 IT Pros & Developers. It's quick & easy.

Importing modules from packages with relative imports

P: n/a
With the old import system, and a package that looks like this:


If I wanted to delay importing baz until it was actually used, I could
leave the files empty and simply "import bar.baz".
However, with the new relative imports syntax, "from . import bar.baz"
causes a syntax error. I could use something like "from .bar import
baz as bar_baz", but that's long, annoying to write, and requires
changing all the uses of "bar.baz.spam" to "bar_baz.spam" through the
file. Is there any way to achieve the "bar.baz" name with relative
Jun 27 '08 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.