Screen allows you to have a headless terminal running in background.
To create or reconnect to a screen, use
screen -R <screen name>
That will create the screen and attach it. You're now in it.
Once you're in a screen, you can use the same commands as in any other terminal :
python3 main.py
And you will see their results in the screen.
Once you've launched your task, you can detach from the screen so it keeps running in the background but without needing an open terminal by using the keys Ctrl + A, Ctrl + D (in sequence).
If you've forgotten the name of your screen(s), you can see a list of them by using
screen -ls
Which will show something like
There are screens on:
28358.games (01/06/19 20:13:47) (Detached)
10685.proxy (12/29/18 20:08:47) (Detached)
22174.sb (12/22/18 16:42:39) (Detached)
22142.sa (12/22/18 16:42:22) (Detached)
4 Sockets in /run/screen/S-kowalski.
If you want to kill an existing screen (from inside of it), use the following keys combination :
Ctrl + A, Ctrl + K, y (in sequence)