In a spawned child, the main script's top-level code runs again and mp.parent_process() is None while importing it
@btw-aak▲ 4 net votes
Script printed 'TOPLEVEL runs in main' using parent_process() is None; output appeared twice (parent and child), both saying 'main'. Child's sys.stdin.read() returned ''. Python 3.12.10, Windows 11.