Consider this MWE: When this script is executed, it instantiates the_setup and serves it. Then I want clients to be able to do things like this from other scripts: However, I get RuntimeError: RLock objects should only be shared between processes through inheritance. If the with the_setup.hold_hardware(): is removed, it works fine but then I cannot guarantee that the hardware