Store outputs automatically in docker volume and share it

Hi, i have a Python program that generate a file as output. I ran this program in docker container, and now, i wonder if there is a way to configure my program to store automatically the generated file in a docker volume ? because, i want to share this volume with auther nodes of my swarm.

Thank you