TypeError: 'module'/'int'/'str' object is not callable (tested)

TypeError: 'X' object is not callable means you put parentheses after something that isn't a function or class. The type in quotes tells you what you actually called. We measured the common versions on Python 3.13.5: 'module', 'int', 'str', 'list', 'dict' and 'NoneType'.

1. 'module' object is not callable

import datetime, random
for expr in ["datetime(2026, 1, 1)", "random()"]:
    try:
        eval(expr)
    except TypeError as e:
        print(f"{expr}: {e}")
print(datetime.datetime(2026, 1, 1).date(), random.random() < 1)
from datetime import datetime
print(datetime(2026, 1, 1).date())

Output:

datetime(2026, 1, 1): 'module' object is not callable. Did you mean: 'datetime.datetime(...)'?
random(): 'module' object is not callable. Did you mean: 'random.random(...)'?
2026-01-01 True
2026-01-01

Measured on Python 3.13.5: import datetime gives you the module; the class inside it is datetime.datetime. Same for random.random, pprint.pprint, tqdm.tqdm, glob.glob, socket.socket. Python 3.13 adds a Did you mean: 'datetime.datetime(...)'? hint. Either call module.name(...) or use from module import name.

2. 'int'/'list'/'str' object is not callable: a shadowed built-in

total = sum([1, 2, 3])
sum = 0                                # shadows the built-in
for x in [4, 5]:
    sum += x
try:
    print(sum([1, 2]))
except TypeError as e:
    print("sum:", e)
list = [1, 2]
try:
    list("abc")
except TypeError as e:
    print("list:", e)
str = "hello"
try:
    str(5)
except TypeError as e:
    print("str:", e)

Output:

sum: 'int' object is not callable
list: 'list' object is not callable
str: 'str' object is not callable

Measured: assigning to sum, list, str, dict, max, input or type replaces the built-in for the rest of the module, so a later call hits your variable. Rename the variable (total, items, text). In a notebook or REPL the shadowing survives until you run del sum (checked: the built-in comes back), or restart the kernel.

3. Calling an attribute, property, dict, or a number

class Account:
    def __init__(self):
        self.balance = 100
    @property
    def owner(self):
        return "ada"
a = Account()
for expr in ["a.balance()", "a.owner()"]:
    try:
        eval(expr)
    except TypeError as e:
        print(f"{expr}: {e}")
d = {"k": 1}
try:
    d("k")
except TypeError as e:
    print('d("k"):', e)
x, y = 2, 3
try:
    print(x(y + 1))                    # meant x * (y + 1)
except TypeError as e:
    print("x(y + 1):", e)

Output:

a.balance(): 'int' object is not callable
a.owner(): 'str' object is not callable
d("k"): 'dict' object is not callable
x(y + 1): 'int' object is not callable

Measured: a.balance is a value, and a @property is read without parentheses, so a.owner() calls the string it returned. Dicts are indexed with d["k"], not d("k"). Python has no implicit multiplication: x(y + 1) is a call, write x * (y + 1). A method with the same name as an attribute set in __init__ causes the same thing (the instance attribute wins).

4. 'NoneType' object is not callable

def get_handler():
    return None
try:
    get_handler()()
except TypeError as e:
    print(e)
import json
data = '{"a": 1}'
try:
    json.loads(data)()
except TypeError as e:
    print(e)

Output:

'NoneType' object is not callable
'dict' object is not callable

Measured: something returned None (or a dict, etc.) and the code called the result. Look at the expression just before the (: a function that forgot to return, a lookup that found nothing, or a decorator that doesn't return its wrapper.

Frequently asked questions

What does TypeError: 'module' object is not callable mean?

You called a module instead of the function or class inside it, e.g. datetime(...) after import datetime. We measured Python 3.13 suggesting datetime.datetime(...); use that or from datetime import datetime.

Why do I get 'int' object is not callable?

Usually a variable named sum, max or similar shadowed the built-in, or you wrote x(y + 1) meaning multiplication. We measured both; rename the variable or write x * (y + 1).

Why do I get 'str' object is not callable?

str was reassigned (str = 'hello'), or you called a property or string attribute with parentheses. We measured both cases.

How do I fix a shadowed built-in in Jupyter?

Run del sum (or whichever name) to remove your variable; we checked the built-in works again afterwards. Then rename the variable in your code.

What does 'NoneType' object is not callable mean?

The thing before the parentheses is None, often a function that didn't return anything or a decorator missing return wrapper. We measured get_handler()() with a None-returning function.

Written with AI assistance. Measured on 2026-10-09 with Python 3.13.5 on Linux: calling the datetime and random modules, shadowed sum/list/str, calling an int attribute, a property, a dict and an int, and calling a None result. Every block was run verbatim and its output pasted from that run. The 'Did you mean' hint wording may differ on older Python versions (not tested). PlainHeaders is our extension; everything else here is built-in Python.