Django

'module' object is not callable

Going9 2023. 11. 3. 10:23

함수를 외부의 파이썬 파일에 분리하고 import 하여 사용하려고 했음.

그런데 'module' object is not callable 발생함.

기존코드

 # s3에 업로드
 photo1_url = upload_s3(photo1, examinee_name)
 photo2_url = upload_s3(photo2, examinee_name)

 

 

문제점은 파일 이름과 함수 이름이 upload_s3로 같아서 함수를 사용한 줄 알았음.

 

아래처럼 한단계 더 들어가주니 정상작동함

from photo_comparisons.utils import upload_s3

# s3에 업로드
photo1_url = upload_s3.upload_s3(photo1, examinee_name)
photo2_url = upload_s3.upload_s3(photo2, examinee_name)