Skip to content
TypeError: '...' object is not callable

TypeError: '...' object is not callable

DodaTech 2 min read

TypeError: '...' object is not callable appears when you use parentheses () on something that isn’t a function, class, or any callable object.

What It Means

You tried to “call” something with () that Python can’t invoke. Only functions, classes, and objects with a __call__ method are callable. Integers, strings, lists, and most other types are not.

Why It Happens

  • Using parentheses on a non-function variable (e.g. x = 5; x())
  • Assigning a value to a name that was previously a function (e.g. len = 10; len("hello"))
  • Missing an operator between parentheses (e.g. print("a")("b") instead of print("a", "b"))
  • Calling a string or number by mistake
  • Method vs property confusion — using () on a property that returns a non-callable

How to Fix It

Step 1: Don’t call non-callable objects

# BAD — integers aren't callable
x = 42
print(x())

# GOOD
x = 42
print(x)

Step 2: Don’t overwrite function names

# BAD — 'max' is now an integer, not a function
max = 100
print(max(10, 20))  # TypeError: 'int' object is not callable

# GOOD
max_value = 100
print(max(10, 20))  # Works: max is still the built-in

Step 3: Fix accidental double-parentheses

# BAD — this calls the result of print(), which is None
print("hello")("world")

# GOOD
print("hello", "world")
# Or on separate lines:
print("hello")
print("world")

Step 4: Use methods correctly

# BAD — 'upper' is a method, but 'name' is a string
name = "alice"
print(name.upper)  # <built-in method upper...> — missing ()

# GOOD
print(name.upper())  # "ALICE"

Step 5: Check class vs instance confusion

class MyClass:
    def __init__(self):
        self.value = 10

# BAD
obj = MyClass  # Missing parentheses — obj is the class itself
print(obj())   # This might work (creates instance), but not what you wanted

# GOOD
obj = MyClass()  # obj is now an instance
print(obj.value)
Can I make my own objects callable?
Yes. Define a __call__ method on your class. This lets you use object instances as if they were functions, which is useful for decorators, callbacks, and stateful functions.
Why does 'str' or 'list' become not callable?
You probably assigned a value to str or list somewhere in your code. Since they’re built-in names, reassigning them shadows the original. Search your code for lines like str = ... or list = ... and rename those variables to something else like my_str or my_list.

Built by the developers of DodaTech

Doda Browser, DodaZIP & Durga Antivirus Pro