The python-flask problem (oserror: [errno 98] address already in use flask)

I was having a look at python-flask framework some days ago. In my Ubuntu 18.04 terminal was showing a error as below when I was running flask run-

oserror: [errno 98] address already in use flask

I was trying heart and soul to solve this. Finally got a solution-

1. Paste following code in terminal

ps -fA | grep python

You will get a pid number by naming of your flask number. Now copy the pid number from second column of your project row of terminal output.

2. Then write as below-

kill -9 pid

The terminal will restart and then the command-

flask run

Will work fine!

Thank you.. :)