Python "from xxx.yyy import xxx" error

python

Solution

This is the proper way to alias a module via import:

import facebook.djangofb as facebook

Problem

I'm working with the `PyFacebook` package in Python, and I've seen people mention numerous times that you can write an import statement as follows: ``` from facebook.djangofb import facebook ``` However, it does not work. It states that `facebook.method_name` exists in the `facebook` module, rather than the `djangofb` module. I assume I'm importing the `facebook.method_name` as `facebook`, not that I'm receiving it from the `facebook` package itself. I'm using Python 2.6. How can I alias `facebook.djangofb` as `facebook`?

Original source

Related problems