You could make a system call that executes the following commands:
systemctl stop wpa_supplicant
systemctl restart wpa_supplicant
Thanks! Will look into that.