After trying every possible solution online I am posting this question. I have a python script that runs on boot with the help of systemd. Everything worked fine till I installed a fresh raspian buster. Now I am able to run the python program via both systemd and through Thonny Editor. But the difference is that systemd doesn't give any audio output while the editor does. I tried to run my python script via terminal and the audio was playing without any issues.
Now please note that I have another raspberry pi which is still running the older version of the OS with the same systemd configuration and everything works fine in it. Now I could have easily cloned that sd card and used it but that sd card is 16 GB and I want to migrate to a 32 GB sd card(I tried cloning, pi didn't boot up)
This is the systemd service file
[Unit] Description=My Service After=network.target [Service] ExecStart=/usr/bin/python3 -u Main.py WorkingDirectory= /home/pi/xyz StandardOutput=inherit StandardError=inherit Restart=always User=pi [Install] WantedBy = default.target
Systemd runs the python file without any errors but with no audio output. Please help me out.