Thanks for the comments so far. This sounds to be more complicated in detail than I expected. I wonder how all the other Python programs and scripts are doing that...