First check the device name on the wifi connection

pi@pi:~ $ iwconfig
lo        no wireless extensions.
eth0      no wireless extensions.
wlan0     IEEE 802.11  ESSID:"stugan"  
Mode:Managed  Frequency:5.24 GHz  Access Point: .....

If the command is missing, run

pi@pi:~ $ sudo apt install wireless-tools

Then edit create the file /etc/systemd/system/wlanpower.service
and paste the following code replacing wlan0 with the correct name from the iwconfig command

[Unit]
Description=Disable wlan powerdown
After=network-online.target
Wants=network-online.target


[Service]
Type=oneshot
ExecStart=/sbin/iw wlan0 set power_save off

[Install]
WantedBy=multi-user.target

Then activate it with the command

systemctl enable wlanpower

Then it should work after the next reboot