I want to run a script that generates an output file, let's say it is called 'output', in parallel. How can I rename the output files so it is not overwritten? Such as generating them as 'output-1', output-2' etc. Ideally it is dynamic enough such that running the script again does not overwrite the existing outputs.
You could use a random filename:
import uuid
filename = f"output-{uuid.uuid4()}"
# use filename