I have a python script which uses selenium to automate web page, drawing focus away from the terminal where user input is required.
Is there anyway in python
If you don't care about clearing any figure displayed in the matplotlib frame -- which I believe is normally the case when one wants to get the focus back on the console for user input -- use simply this:
plt.close("all")