I have a pi zero W and I'm wanting to be able to switch it between AP and client mode whenever I want without rebooting.
I used the method on the raspberry pi website to configure my pi as an AP (stopping at "add routing and masquerade"), but that assumes I'll never want to switch back. Also, I'm quite restricted in how I use it because I'm relying entirely on SSH to send these commands, so if both AP and client mode get disabled somehow, I'll need to edit the SD card directly to fix it.
Any help is appreciated.
Edit: I'm currently using a workaround where when I want to switch, I enable and disable hostapd and wpa_supplicant respectively, and then copy a /etc/dhcpcd.conf so that it uses 192.168.0.1/24 in AP mode, and whatever the router wants in client mode. I just want to do this without rebooting and without overwriting config files every time.