Where are you used these python scripts? Work within data source or python visual? If you mean data source side and these session operations are integrated in the same query step, it is possible.
If you are working with python visual, these types of operations will been blocked on power bi service side due to security reasons.
For the python script hosted in different query steps, I don't think you can directly transmit data between these steps that invoked python scripts.
Community Support Team _ Xiaoxin
If this post helps, please consider accept as solution to help other members find it more quickly.