Two terminals in Pycharm

How do I open two projects/terminals in Pycharm, so that they should be run in separate terminal windows ?

I can open one project but don’t know how to open the second one.

I tried.

File => Open =>

But this does not open the two projects side by side.

generally pycharm supports one project per window. and each window can have any number of open terminals.

if you describe why you want to do this perhaps I can offer some better advice.

I actually need two terminals.

I would like to run TCP IP Echo Server and Client programs on the same Windows machine. The programs are stored in two python files.

I need to run them one after the other. That’s why I need to see the output of each program and this needs two terminals.

personally what I’d do is write the client / server in the same pycharm project, once you’ve done this open a terminal (for me this is alt-f12) right click on the terminal tab and click split right

1 Like

Option 1: Open Two Projects in Separate PyCharm Windows

  1. Open the First Project:
  • Launch PyCharm.
  • Open the first project containing the first Python file (e.g., server.py).
  1. Open the Second Project in a New Window:
  • Go to File > Open.
  • Select the folder containing the second project (or client file, e.g., client.py).
  • When prompted, choose “New Window” instead of “This Window”.
  • PyCharm will open the second project in a completely separate window.
  1. Run Scripts in Separate Terminals:
  • In the first PyCharm window, open and run the first script (server.py) by clicking on the green play icon in the editor or terminal configuration.
  • In the second PyCharm window, open and run the second script (client.py).
  • Each PyCharm window will have its own terminal, allowing you to see the output of both programs side by side.

Option 2: Use Multiple Terminals in One Project

If you don’t want to open separate projects and prefer to keep everything in one PyCharm project:

  1. Open the Project Containing Both Files:
  • Open the project folder that contains both server.py and client.py.
  1. Run the First Script:
  • Open server.py and run it by:
    • Right-clicking on the file and selecting Run.
    • Or clicking the green play button in the editor.
  1. Open a Second Terminal:
  • In PyCharm, go to the bottom and open the Terminal tab.
  • Click the + button (or Alt + F12 to toggle the terminal, and then + to open a new session).
  • You’ll now have two terminal tabs.
  1. Run the Second Script:
  • In the second terminal session, navigate to the folder containing client.py (if needed) and run it using:

bash

Copy code

python client.py
  1. View Outputs Side by Side:
  • You’ll now have the server output in one terminal and the client output in another.

Option 3: Use Run Configurations to Open Two Terminals

  1. Create Two Run Configurations:
  • Go to Run > Edit Configurations.
  • Click the + button to add a new configuration for the server:
    • Name: Server
    • Script path: Path to server.py
  • Add another configuration for the client:
    • Name: Client
    • Script path: Path to client.py
  1. Run Configurations in Parallel:
  • Select Server from the run configuration dropdown and run it.
  • Open the dropdown again, select Client, and run it.
  • PyCharm will open separate terminal windows for each configuration, showing outputs simultaneously.
1 Like

I am trying Option 1.

  • Launch PyCharm
  • Open the first project containing Python file
  • Open the second project, File > Open

I don’t get the option

  • When prompted, choose “New Window” instead of “This Window”.

It just close the first project and open the second project.

I also tried the Option 2.

Option 2: Use Multiple Terminals in One Project

I added both python files, server.py and client.py in the same project. At the moment I only have two print hello statements in them. Rest of the program in each file is commented.

I can open both of them and see the code. After running the first, which has an output in the terminal, when I run the second program, the terminal of the first close automatically and the terminal of the second program is there.

I just manage to run two terminals at the same time.

I created a Pycharm project. Added two python files.

Manually added/opened two terminals at the bottom. with “+” button. Both are pointing to the project directory in which I have two python files. I change the name of both terminals and run python file in each manually.
It works.

By the word “terminal”, do you mean “Run Output Window/Pane” or actual “Terminal Window/Pane” ?

Because in PyCharm, those are 2 different things.

If what you need are 2 “Run Output Window/Panes”, then do this:

  1. Run your first program.
  2. Right click on the program output’s tab, and choose “Pin”
  3. Run your second program.

I am not sure if I get it. Kindly explain bit more. Thanks.

First, the two different things:

#1 = Output Window/Panes
#2 = Terminal Window/Panes

Since you mentioned about running the first program, I believe what you meant was the output window/pane, rather than “terminal”.

Then you mentioned that as you run the second program, you see the second program’s output replacing the first program’s output.

That doesn’t happen if the first program hasn’t ended; if the first program is still running, PyCharm will add another output tab.

If you for any reasons want to keep the output tab of the first program even if it has completed, you have to *pin it; pinning a tab prevents PyCharm from replacing that output tab.

See picture:

  1. Right-click on the tab,
  2. Choose “Pin tab”

I tried #2 = Terminal Window/Panes and it works.