Forums

Importing Module with same name

Hi all. I've installed the "python-twitter" using pip install. The problem is:

PythonAnywhere already have a module in "battery-included" named "twitter". And "python-twitter" (module i've installed) is called by Python the same way (import twitter).

So, how can i choose and import my module (python-twitter) instead "twitter" module, as they have same name?

Thanks.

We order the python path so that modules you have installed are found first, so it should just import your module.

Really? What's could be wrong?

Because when i do import, i can't run any methods from "python-twitter"...as if it was running "twitter" module instead of mine.

OK. Try this in a Python console:

import twitter                                                                                                                                          
twitter.__file__

and you should see that the file of the module you imported is in /home/starklabs/.local

glenn, thanks a lot.

In fact, it worked, in about 10 minutes later after pip installation.

Anyway, thank you so much for your fast help.

Best regards.