The yml:
- name: RUN PYTHON ON TARGET
changed_when: false
shell: python3 /.../try_python.py {{side_a}}
become: true
become_user: xxxx
register: py_output
The script (adapted to AAP and tested locally):
# name = input()
with open("/.../try_txt.txt", "w") as file:
file.write(f"{{$1}}")
The survey contains only the "side_a" variable, and it is working already for bash cases.