TypeError: 'module' object is not callable (tested)
TypeError: 'module' object is not callable means you called a module as if it were the function or class inside it. We reproduced the common versions on Python 3.13.5.
1. You called the module instead of the thing inside it
python3 -c "import datetime; datetime(2026, 1, 1)" 2>&1 | tail -1
python3 -c "import pprint; pprint({'a': 1})" 2>&1 | tail -1
python3 -c "import json; json('{}')" 2>&1 | tail -1
Output:
TypeError: 'module' object is not callable. Did you mean: 'datetime.datetime(...)'?
TypeError: 'module' object is not callable. Did you mean: 'pprint.pprint(...)'?
TypeError: 'module' object is not callable
Measured on Python 3.13.5: import datetime gives you the module datetime; the class with the same name is datetime.datetime. Calling the module raises TypeError: 'module' object is not callable. When the module contains something with its own name, Python 3.13 says what you meant (Did you mean: 'datetime.datetime(...)'?). json has no json inside it, so that error comes with no hint.
import datetime
print(type(datetime), callable(datetime))
from datetime import datetime
print(type(datetime), callable(datetime), datetime(2026, 1, 1))
Output:
<class 'module'> False
<class 'type'> True 2026-01-01 00:00:00
Measured: the same name is a module after import datetime and a class after from datetime import datetime. Whichever import runs last wins, which is how a file with both imports at the top ends up broken in some places only.
2. Your own file and function share a name
mkdir -p demo && cd demo
cat > helper.py <<'PY'
def helper():
return "called"
PY
python3 -c "import helper; helper()" 2>&1 | tail -1
python3 -c "from helper import helper; print(helper())"
python3 -c "import helper; print(helper.helper())"
Output:
TypeError: 'module' object is not callable. Did you mean: 'helper.helper(...)'?
called
called
Measured: helper.py defines helper(). import helper; helper() calls the module. Either import the function (from helper import helper) or call it through the module (helper.helper()). Both work.
Quick check
import json
print(json)
from json import loads
print(loads("{}"), callable(loads))
Output:
<module 'json' from '/usr/lib/python3.13/json/__init__.py'>
{} True
Measured: printing the name shows <module 'json' from ...> if it's a module. Then import the function or class you need from it. For other "is not callable" errors (a variable shadowing a function, a missing operator) see our object is not callable guide.
Frequently asked questions
What does TypeError: 'module' object is not callable mean?
You called a module like a function, e.g. datetime(...) after import datetime. We measured it on Python 3.13.5, with a 'Did you mean: datetime.datetime(...)' hint.
How do I fix 'module' object is not callable?
Call the function or class inside the module (datetime.datetime(...)) or import it directly (from datetime import datetime). We measured both forms working.
Why do I get module not callable for my own file?
Your file and the function in it have the same name. We measured import helper; helper() failing and from helper import helper working.
Why is there no 'Did you mean' hint?
Python 3.13 only suggests module.name(...) when the module has an attribute with its own name. We measured json('{}') failing with no hint.
Written with AI assistance. Measured on 2026-10-09 with Python 3.13.5: calling the datetime, pprint and json modules, import datetime vs from datetime import datetime, and a local helper.py whose function shares its name. Every block was run verbatim and its output pasted from that run. PlainHeaders is our extension; everything else here is built-in Python.