environment

uname -a
Linux 4.19.0-18-cloud-amd64 #1 SMP Debian 4.19.208-1 (2021-09-29) x86_64 GNU/Linux

Take over variables

To share a directory name between python and bash, you can enclose it in {}.

outdir = './out/'

Create a directory in bash.

! mkdir -p {outdir}
! echo {outdir}
./out/

The variable was retrieved. Congratulations!