Skip to content

How to execute python module?


Watch as a video

Table of Contents

Open Table of Contents

Execute python script in terminal

A basic python looks something like the following.

# file:
print("Hello World!!!")

python is a command that tells the Python interpreter to execute a Python script named

Here’s what each part means:

Execute python project in terminal

A sample project will look something like the following.


├── sample_project
│   ├──
│   ├──

To trigger this sample_project, we can simply pass it as a parameter to python command.

# path: /path/to/project/
python sample_project

When the above command is triggered, python interpreter will look inside the sample_project folder and search for file. the Python interpreter will execute the code contained within the file.

This is called as Python package with an executable module