When you "call" a function you are basically just telling the program to execute that function. So if you had a function that added two numbers such as:

def add(a,b):
    return a + b

you would call the function like this:

add(3,5)

which would return 8. You can put any two numbers in the parentheses in this case. You can also call a function like this:

answer = add(4,7)

Which would set the variable answer equal to 11 in this case.

Answer from Joel Green on Stack Overflow
๐ŸŒ
W3Schools
w3schools.com โ€บ python โ€บ python_functions.asp
Python Functions
In Python, a function is defined using the def keyword, followed by a function name and parentheses: ... This creates a function named my_function that prints "Hello from a function" when called.
Top answer
1 of 4
25

When you "call" a function you are basically just telling the program to execute that function. So if you had a function that added two numbers such as:

def add(a,b):
    return a + b

you would call the function like this:

add(3,5)

which would return 8. You can put any two numbers in the parentheses in this case. You can also call a function like this:

answer = add(4,7)

Which would set the variable answer equal to 11 in this case.

2 of 4
19

I'll give a slightly advanced answer. In Python, functions are first-class objects. This means they can be "dynamically created, destroyed, passed to a function, returned as a value, and have all the rights as other variables in the programming language have."

Calling a function/class instance in Python means invoking the __call__ method of that object. For old-style classes, class instances are also callable but only if the object which creates them has a __call__ method. The same applies for new-style classes, except there is no notion of "instance" with new-style classes. Rather they are "types" and "objects".

As quoted from the Python 2 Data Model page, for function objects, class instances(old style classes), and class objects(new-style classes), "x(arg1, arg2, ...) is a shorthand for x.__call__(arg1, arg2, ...)".

Thus whenever you define a function with the shorthand def funcname(parameters): you are really just creating an object with a method __call__ and the shorthand for __call__ is to just name the instance and follow it with parentheses containing the arguments to the call. Because functions are first class objects in Python, they can be created on the fly with dynamic parameters (and thus accept dynamic arguments). This comes into handy with decorator functions/classes which you will read about later.

For now I suggest reading the Official Python Tutorial.

Discussions

Just a quick beginner question! How are functions executed in Python?
Googled this: https://www.geeksforgeeks.org/understanding-the-execution-of-python-program/ More on reddit.com
๐ŸŒ r/learnpython
13
1
January 10, 2023
Execute functions in specific order
Why do you NOT want to simply call the functions in order? Do you expect the list of functions to change? If so, a list of functions is the way to go: fnlist = [ function1, function2, ] for func in fnlist[start:]: func() So you would set the 'start' variable to the index of the first thing to run, then loop through. More on reddit.com
๐ŸŒ r/Python
8
0
March 10, 2019
How to Call a python script from a HTML button in django?
for starters, you dont need to call the script that way. depending on how you have it written, you can just import the parts from the file and run them. Python has a mechanism to determine whether something was run from the command line or imported. that way you can use your file like a library and a standalone script: if __name__ == '__main__': # do your command-line only setup here also, regardless of whether you're calling python or not, string passing like that to start system processes is fragile, and it easily leads to security holes. there's usually a better way to go about it in your case, I don't believe run returns a value, so there's nothing to print More on reddit.com
๐ŸŒ r/django
8
3
April 9, 2020
wait_for function call help in discord.py
Please share code blocks using 4 spaces before each line. It ensures that indentation is preserved (especially handy when sharing python code). Have you got the full code you are using? It seems probable that your bug is coming from somewhere outside this small snippet. Censor any API keys or account information in your code before posting it. Github gists (or pastebin) are an easy way to share a lot of code at once. More on reddit.com
๐ŸŒ r/Discord_Bots
7
16
March 12, 2021
๐ŸŒ
DataCamp
datacamp.com โ€บ tutorial โ€บ functions-python-tutorial
Python Functions: How to Call & Write Functions | DataCamp
May 18, 2026 - In the previous sections, you have seen a lot of examples already of how you can call a function. Calling a function means that you execute the function that you have defined - either directly from the Python prompt or through another function (as you will see in the section โ€œNested Functionsโ€).
๐ŸŒ
CodingNomads
codingnomads.com โ€บ how-to-call-a-function-in-python
How to Call a Function in Python
To execute a function, you need to call it. You do that by writing the function's name followed by opening and closing parentheses. If your function requires parameters, you need to pass the right amount of arguments in between the parentheses.
๐ŸŒ
freeCodeCamp
freecodecamp.org โ€บ news โ€บ how-to-define-and-call-functions-in-python
How to Define And Call Functions in Python
December 11, 2025 - To call a function in Python, you simply type the name of the function followed by parentheses ().
๐ŸŒ
GeeksforGeeks
geeksforgeeks.org โ€บ python โ€บ how-to-define-and-call-a-function-in-python
How to Define and Call a Function in Python - GeeksforGeeks
July 23, 2025 - To call a function in Python, we definitely type the name of the function observed via parentheses (). If the function takes any arguments, they may be covered within the parentheses .
๐ŸŒ
GeeksforGeeks
geeksforgeeks.org โ€บ python โ€บ python-functions
Python Functions - GeeksforGeeks
Python functions are reusable blocks of code used to perform a specific task. They help organize programs into smaller sections and execute the same logic whenever needed by calling the function.
Published ย  12 hours ago
Find elsewhere
๐ŸŒ
Runestone Academy
runestone.academy โ€บ ns โ€บ books โ€บ published โ€บ fopp โ€บ SimplePythonData โ€บ FunctionCalls.html
2.4. Function Calls โ€” Foundations of Python Programming
The Python interpreter can compute new values with function calls. You are familiar with the idea of functions from high school algebra. There you might define a function f by specifying how it transforms an input into an output, f(x) = 3x + 2.
๐ŸŒ
Reddit
reddit.com โ€บ r/learnpython โ€บ just a quick beginner question! how are functions executed in python?
r/learnpython on Reddit: Just a quick beginner question! How are functions executed in Python?
January 10, 2023 -

Hi, everyone! I've picked up Python 6 hours ago. My previous experience (more than 15 year ago) was limited to Turbo Pascal and a little C.

A normal program for me would look like:

define function

begin

call function

end

My Python program looks like:

define function1

call function2

define function2

call function 3

define function3

if cond1 call function1

elif cond2 do nothing

else call function 3

some other code

AND IT WORKS! The program does what I ask it to do without any errors. Is this normal? Does a python program start with the first function it encounters even if it's not called main() ?

๐ŸŒ
Stanford CS
cs.stanford.edu โ€บ people โ€บ nick โ€บ py โ€บ python-function.html
Python Functions
Python mixes regular function calls and OOP function calls. Many languages use this "OOP" style, as it has a nice quality of thinking about what data you want to work on first, and then what operation to perform on that data. Suppose we have a paint_window() function that fills a computer window with a color. We want a way to tell the function what color to use when calling it โ€” blue or red or whatever. A parameter is extra information supplied by the caller that customizes the run of the called function.
๐ŸŒ
In Easy Steps
ineasysteps.com โ€บ home โ€บ a quick guide to python functions (with examples)
A quick guide to Python functions (with examples) - In Easy Steps
February 7, 2023 - Functions can also return values ... other functions. Functions in Python can be called by their name, followed by a set of parentheses that may contain arguments....
๐ŸŒ
freeCodeCamp
freecodecamp.org โ€บ news โ€บ python-functions-define-and-call-a-function
Python Functions โ€“ How to Define and Call a Function
March 16, 2022 - In programming, a function is a reusable block of code that executes a certain functionality when it is called. Functions are integral parts of every programming language because they help make your code more modular and reusable. In this article, I will show you how to define a function in Python and call it, so you can break down the code of your Python applications into smaller chunks.
๐ŸŒ
Guru99
guru99.com โ€บ home โ€บ python โ€บ how to call a function in python (example)
How to Call a Function in Python (Example)
August 12, 2024 - Function in Python is defined by the โ€œdef โ€ statement followed by the function name and parentheses ( () ) ... Let us define a function by using the command โ€ def func1():โ€ and call the function.
๐ŸŒ
Programiz
programiz.com โ€บ python-programming โ€บ function
Python Functions (With Examples)
It's because creating a function doesn't mean we are executing the code inside it. It means the code is there for us to use if we want to. To use this function, we need to call the function.
๐ŸŒ
freeCodeCamp
freecodecamp.org โ€บ news โ€บ how-to-call-a-function-in-python-def-syntax-example
How to Call a Function in Python โ€“ Def Syntax Example
July 20, 2022 - Before you call a function, you need to write it with the def keyword. So in this article, I will not just show you how to call a function, I will also show you how to create it. ... To define a function in Python, you type the def keyword first, ...
๐ŸŒ
TutorialsPoint
tutorialspoint.com โ€บ article โ€บ calling-a-function-in-python
Calling a Function in Python
March 25, 2026 - The basic syntax for calling a function is function_name(arguments). The function call must match the parameters defined in the function ?
๐ŸŒ
GeeksforGeeks
geeksforgeeks.org โ€บ python โ€บ how-to-call-a-function-in-python-2
How to call a function in Python - GeeksforGeeks
July 23, 2025 - Here's a simple example: In this example, greet is the name of the function, and it doesn't take any parameters. ... To call a function, you simply use the function name followed by parentheses.
๐ŸŒ
Python Morsels
pythonmorsels.com โ€บ calling-a-function
How to call a function in Python - Python Morsels
November 11, 2020 - If we type sum and hit the Enter ... to. To use this function, we need to put parentheses after it. Putting parentheses after a function will call the function....
๐ŸŒ
Scaler
scaler.com โ€บ home โ€บ topics โ€บ how to call a function in python?
How to Call a Function in Python? - Scaler Topics
February 2, 2024 - In this example, we are defining a function and then calling it and printing the values. ... In this example, we are printing the value from inside the function. ... Scaler learners achieved 2.5x salary growth with average post-Scaler CTC reaching โ‚น23L. ... Data can be passed into functions as arguments. Arguments are specified after the function name, inside the parentheses. You can add as many arguments as you want, separated with commas. ... Arguments are often shortened to args in Python documentations.
๐ŸŒ
Intellipaat
intellipaat.com โ€บ home โ€บ blog โ€บ how to call a function in python| learn types & methods
How to Call a Function in Python| Learn Types & Methods
May 29, 2025 - In this example, calling โ€œouter_function(5)โ€ triggers the nested inner_function to double the value passed (5), resulting in โ€œ10โ€. The outer function then returns this result, which is printed to the console. In Python, the return statement is used within a function to specify the result that should be returned to the caller once the function has finished executing.