So i have structure like this
And i want to import userlist.py from server.py. Server py:
import socket
from server import userlist #<-- error here
class Server():
def __init__(self,port):
Other files in server don't have any refferences to userlist. It says cannot import name userlist
If i change import to
from server.userlist import Userlist
it says: 'server' is not a package
Try just
When you are importing a file (module) in the same directory, all you need to do is import the name of that file without the
.py
part.