Reputation: 3
For some reason I receive an ImportError
every time I try to import a class from another file. Here's the github page for my project: https://github.com/wheelebin/mcnextbot
Here's the error that I'm receiving:
Traceback (most recent call last):
File "ircbot.py", line 36, in <module>
from test import mcnextlvl
ImportError: cannot import name mcnextlvl
Upvotes: 0
Views: 5946
Reputation: 11
The __init__.py
python file allow you can import your individual modules named 'test' from the lib package.
Upvotes: 1
Reputation: 34047
Here your from test import something
refers to the module test
in <PYTHONPATH>/lib
, not yourselves test.py
, and there is no submodule/class mcnextlvl
there. You should use from lib.test import mcnextlvl
as @sgmart commented.
Upvotes: 1