Code
(
sleep 10
systemctl stop kodi
pactl load-module module-udev-detect
pactl set-default-sink alsa_output.0.iec958-stereo
pactl set-default-source bluez_source.74_9E_AF_73_EC_4F.a2dp_source
systemctl start kodi
)&
autostart.sh runs at the start of userspace boot long before Kodi is running so the script will fail. If you (background)& the process with a sleep timer it will run later (10 seconds later in the above example) and should succeed.