You are building a small reporting script for a Chicago sales team. The script accepts a formatting rule from a settings file, then applies it to each sales record. Before calling that rule, you need to know whether it is actually something Python can run.
That is where the callable() function helps. I have used it in automation scripts that accept user-defined functions, callback functions, and class-based handlers. It gives you a quick safety check before you use parentheses on an object.
In this Python tutorial, you will learn what callable() does, how it works with functions, classes, methods, and custom objects, and when you should use it in real scripts.
What Is the Python callable() Function?
The callable() function is a built-in Python function that checks whether an object can be called with parentheses.
In simple terms, an object is callable when you can write parentheses after it, such as object_name().
The function returns one of these Boolean values:
Truewhen Python can call the objectFalsewhen Python cannot call the object
The syntax is simple:
callable(object)
You do not need to install or import anything. callable() comes with Python, just like many other built-in Python functions.
Here is a quick example:
def create_report():
print("Sales report created")
report_title = "September Sales Report"
print(callable(create_report))
print(callable(report_title))
Output:
True
False
You can see the output in the screenshot below.

The create_report variable stores a function, so Python can call it with parentheses. The report_title variable stores a string, and Python cannot execute a string like a function.
Why Use Python callable()?
Python is dynamically typed. That means a variable can hold a function, string, number, class, list, or another object at runtime. This flexibility is useful, but it can also cause errors when your script expects a function and receives something else.
For example, this code fails because a string is not callable:
status_message = "Report ready"
status_message()
Output:
TypeError: 'str' object is not callable
You can prevent this error by checking the value first:
status_message = "Report ready"
if callable(status_message):
status_message()
else:
print("The value is not callable.")
Output:
The value is not callable.
You can see the output in the screenshot below.

This approach is especially useful when you build a configurable automation script. A script may receive a function from another module, a class method, a callback, or a value loaded from a dictionary.
If you are new to functions, first learn how to define a function in Python and call a function in Python. Those two basics make callable() much easier to understand.
Python callable() Function with Functions
A regular function is callable because you can execute it with parentheses.
Here is a simple report formatter example:
def format_sales_amount(amount):
return f"${amount:,.2f}"
sales_amount = 24850.75
print(callable(format_sales_amount))
if callable(format_sales_amount):
formatted_amount = format_sales_amount(sales_amount)
print(formatted_amount)
Output:
True
$24,850.75
You can see the output in the screenshot below.

The script first checks whether format_sales_amount is callable. It then calls the function only when the check returns True.
This pattern becomes useful when your script receives a function as a parameter. Passing a function into another function is common in reusable automation tools.
Use callable() Before Running a Callback Function
A callback function is a function that another function receives and runs later. You often use callbacks in event-driven apps, data processing, and reusable utility scripts.
For example, imagine that Emily Carter manages a local sales-report automation tool. She wants to run an optional notification function after exporting a report.
def export_sales_report():
print("Sales report exported to Excel.")
def send_notification():
print("Notification sent to Emily Carter.")
def run_report_job(callback=None):
export_sales_report()
if callable(callback):
callback()
else:
print("No callable notification function was provided.")
run_report_job(send_notification)
Output:
Sales report exported to Excel.
Notification sent to Emily Carter.
The run_report_job() function accepts callback as an optional argument. It uses callable() before running the callback, so the script does not fail when the caller provides None or another non-function value.
Now run the same function without a callback:
def export_sales_report():
print("Sales report exported to Excel.")
def run_report_job(callback=None):
export_sales_report()
if callable(callback):
callback()
else:
print("No callable notification function was provided.")
run_report_job()
Output:
Sales report exported to Excel.
No callable notification function was provided.
You can also pass a callback directly with a lambda function in Python:
def run_report_job(callback=None):
print("Sales report exported to Excel.")
if callable(callback):
callback()
else:
print("No callable notification function was provided.")
run_report_job(lambda: print("Report job completed successfully."))
Output:
Sales report exported to Excel.
Report job completed successfully.
Pro Tip: I use
callback=Noneas the default for optional callbacks. Avoid using a string such as"send_email"as a placeholder. ANonevalue clearly means “no function supplied,” andcallable()handles it safely.
Python callable() Function with Classes
A class is also callable in Python. When you call a class with parentheses, Python creates an object, also called an instance, from that class.
Here is a simple example:
class SalesReport:
def __init__(self, month):
self.month = month
report = SalesReport("September")
print(callable(SalesReport))
print(callable(report))
Output:
True
False
SalesReport is callable because Python uses SalesReport("September") to create a new object.
The report object is not callable in this example because the class does not define a special __call__() method.
If you need a stronger understanding of classes before using this feature, review the difference between a class and instance variables in Python and learn about the constructor in Python.
Python callable() Function with Methods
A method is a function inside a class. Python treats methods as callable objects because you can run them with parentheses.
This example creates a class for a small sales report:
class SalesReport:
def show_summary(self):
print("September sales total: $24,850.75")
report = SalesReport()
print(callable(report.show_summary))
if callable(report.show_summary):
report.show_summary()
Output:
True
September sales total: $24,850.75
The expression report.show_summary refers to the method itself. The expression report.show_summary() calls the method.
That distinction matters. If you add parentheses before your check, Python runs the method immediately. Check the method reference first, then call it only when needed.
Make a Custom Object Callable with _call_()
Python lets you make your own object callable by adding the special _call_() method to a class.
A special method uses double underscores before and after its name. Python calls __call__() whenever you use parentheses after an object.
This is useful when you want an object to behave like a function while still storing settings or state.
For example, suppose Michael Johnson needs a reusable sales-tax calculator for reports generated in Austin.
class SalesTaxCalculator:
def __init__(self, tax_rate):
self.tax_rate = tax_rate
def __call__(self, amount):
tax = amount * self.tax_rate
total = amount + tax
return total
texas_tax = SalesTaxCalculator(0.0825)
print(callable(texas_tax))
print(f"Total amount: ${texas_tax(250):.2f}")
Output:
True
Total amount: $270.62
The texas_tax object works like a function because the class defines __call__().
Here is a more complete example that uses a callable object to format sales records:
class SalesRecordFormatter:
def __init__(self, region):
self.region = region
def __call__(self, salesperson, amount):
return (
f"Region: {self.region} | "
f"Salesperson: {salesperson} | "
f"Sales: ${amount:,.2f}"
)
formatter = SalesRecordFormatter("West")
if callable(formatter):
result = formatter("Olivia Martinez", 18300.50)
print(result)
Output:
Region: West | Salesperson: Olivia Martinez | Sales: $18,300.50
A callable object works well when you need both a reusable action and saved configuration. In this case, formatter remembers the region and processes different salespeople without repeating that setting.
Use callable() in a Function Registry
A function registry is a dictionary that stores functions under names. This design works well when you want a script to choose an action dynamically.
For example, a report processor may need to clean data, format data, or create a summary. The script can store each action in a dictionary.
def clean_customer_name(name):
return name.strip().title()
def format_customer_name(name):
return f"Customer: {name}"
def get_name_length(name):
return len(name)
report_actions = {
"clean": clean_customer_name,
"format": format_customer_name,
"length": get_name_length
}
selected_action = "format"
customer_name = " sarah thompson "
action = report_actions.get(selected_action)
if callable(action):
cleaned_name = clean_customer_name(customer_name)
print(action(cleaned_name))
else:
print("The selected action is unavailable.")
Output:
Customer: Sarah Thompson
The get() method safely retrieves the action. If the dictionary does not contain the requested key, get() returns None. Since None is not callable, the script shows a clear message instead of crashing.
Here is the same example with an unavailable action:
def clean_customer_name(name):
return name.strip().title()
report_actions = {
"clean": clean_customer_name
}
selected_action = "email"
customer_name = " sarah thompson "
action = report_actions.get(selected_action)
if callable(action):
print(action(customer_name))
else:
print(f"No callable action found for: {selected_action}")
Output:
No callable action found for: email
This technique is safer than a long chain of if statements when your automation script supports several named actions. If you want to work more with dictionaries, see how to check whether a key exists in a Python dictionary and create a dictionary in Python using a for loop.
callable() with Built-In Functions and Common Values
Many Python built-in functions are callable. Regular values, such as integers, strings, lists, tuples, and dictionaries, are not callable.
items = [12, 25, 40]
customer = "David Miller"
monthly_target = 50000
print(callable(len))
print(callable(sum))
print(callable(items))
print(callable(customer))
print(callable(monthly_target))
Output:
True
True
False
False
False
The len and sum names point to functions. The other variables store data values.
You can use this knowledge while debugging the common “object is not callable” error. That error often happens after a developer accidentally reuses the name of a built-in function.
For example:
sum = 500
print(sum([10, 20, 30]))
Output:
TypeError: 'int' object is not callable
The variable named sum replaces Python’s built-in sum() function in the current script.
Use a clearer variable name instead:
monthly_sales_total = 500
print(sum([10, 20, 30]))
print(monthly_sales_total)
Output:
60
500
callable() Does Not Validate Function Inputs
The callable() function only answers one question: “Can Python call this object?”
It does not check whether you supplied the correct arguments. A function may be callable but still raise a TypeError if you call it with missing or incorrect parameters.
def calculate_commission(sales_amount, commission_rate):
return sales_amount * commission_rate
print(callable(calculate_commission))
calculate_commission(15000)
Output:
True
TypeError: calculate_commission() missing 1 required positional argument: 'commission_rate'
Use callable() to confirm that an object is callable. Then make sure you understand the function’s required arguments.
You can avoid some issues by using optional function arguments in Python or default function arguments.
Here is a safer version:
def calculate_commission(sales_amount, commission_rate=0.05):
return sales_amount * commission_rate
commission = calculate_commission(15000)
print(f"Commission: ${commission:,.2f}")
Output:
Commission: $750.00
Things to Keep in Mind
- Check before calling: Use
callable()before running optional callbacks, handlers, or functions loaded from a dictionary. - Do not confuse callable with valid: A
Trueresult does not guarantee that the function accepts your arguments or completes without errors. - Avoid shadowing built-ins: Do not name variables
sum,list,str,format, orcallable, because you may overwrite useful built-in functions. - Use None for optional actions: Set an optional callback to
Noneby default, then check it withcallable()before execution. - Keep dynamic calls controlled: Do not call unknown functions from untrusted input. Map approved names to approved functions in a dictionary.
- Use clear error messages: When a value is not callable, print or raise a message that tells the user which expected action is missing.
Frequently Asked Questions
What does callable() do in Python?
The callable() function checks whether an object can be called with parentheses. It returns True for functions, methods, classes, and objects that define __call__(). It returns False for ordinary values such as strings, integers, lists, and dictionaries.
Is a Python class callable?
Yes, a Python class is callable. You call a class to create an object from it, such as SalesReport("September"). The object created by that class is only callable when the class defines __call__().
Why does callable() return True for a class?
Python uses the class name with parentheses to create an instance. Since you can call a class, callable(ClassName) returns True. This result does not mean every object created from that class is also callable.
Can callable() prevent TypeError in Python?
It can prevent errors caused by trying to call a non-callable object, such as a string or integer. However, it cannot prevent every TypeError. A callable function can still fail when you pass the wrong number or type of arguments.
How do I make an object callable in Python?
Create a class and define its __call__() method. Python runs that method whenever you use parentheses after an object created from the class. This pattern works well when an object needs stored settings and function-like behavior.
Should I use callable() in every Python function?
No. Use it when your program receives a function dynamically, such as an optional callback, plugin, event handler, or dictionary-based action. You do not need it when you directly call a function that you defined and control.
The Python callable() function gives you a clean way to check whether Python can execute a value before your script calls it. Start with callback checks and dictionary-based function registries, then use callable objects when your project needs reusable behavior with stored settings.
I hope you found this article helpful and can now use callable() more confidently in your Python scripts.
You May Also Like:
- How to define a function in Python
- How to pass a function as a parameter in Python
- How to return a function in Python
- How to call a function within another function in Python
- How to fix the tuple object is not callable error in Python

Bijay Kumar is an experienced Python and AI professional who enjoys helping developers learn modern technologies through practical tutorials and examples. His expertise includes Python development, Machine Learning, Artificial Intelligence, automation, and data analysis using libraries like Pandas, NumPy, TensorFlow, Matplotlib, SciPy, and Scikit-Learn. At PythonGuides.com, he shares in-depth guides designed for both beginners and experienced developers. More about us.