파이썬이 하위 폴더의 모듈을 가져 오도록 할 수없는 것 같습니다. 가져온 모듈에서 클래스의 인스턴스를 만들려고하면 오류가 발생하지만 가져 오기 자체는 성공합니다. 내 디렉토리 구조는 다음과 같습니다.
Server
-server.py
-Models
--user.py
다음은 server.py의 내용입니다.
from sys import path
from os import getcwd
path.append(getcwd() + "\\models") #Yes, i'm on windows
print path
import user
u=user.User() #error on this line
그리고 user.py :
class User(Entity):
using_options(tablename='users')
username = Field(String(15))
password = Field(String(64))
email = Field(String(50))
status = Field(Integer)
created = Field(DateTime)
오류 : AttributeError : '모듈'개체에 '사용자'속성이 없습니다.