I wonder if there is a way to sign out from the portal in arcpy.
Since I may want to publish a service using arcpy and do some other activities using the Python API, I wonder if I won't be entering problems into my portal if I sign in twice from the same python program, once from arcpy and a second time from the API.
I doubt you will run into any issues. I can sign in to Portal from 3 different browsers on the same machine at the same time, all of which have different tokens after authenticating, and I never have issues because each of the tokens is mapped back to my user.
I'll try it in the next day or two and hopefully it won't break my portal.
Even if there is an issue on the client side, which I doubt there will be, it surely won't break your portal. If corrupting a Portal deployment was that easy, Esri would have major issues with angry customers.
If it weren't so sad, I'd laugh about your comment. I guess I'm one of the angry customers that you mentioned.
In the five years since we entered the portal age, my portal/server has broken for no reason several times. Fortunately, the support representatives of the local distributor are nice and helpful but still, I devoted much time to the portal issues. In summary, marketing talks and technology reality are not always related one to each other
I feel your pain/frustration. I have been working with Esri products for 25+ years, and their server products for almost 15 of those years. Most of what keeps my organization's ArcGIS Server products stable and performing satisfactory has everything to do with the experience of fighting their products over time and little to do with their documentation and support feedback.