Say wifi1 is on 192.168.1.1 and wifi2 is on 10.11.11.1, I think I need a separate static IP for each network e.g. 192.168.1.233 won’t work on wifi2. Is there a way the raspberry pi can automatically switches between IP’s based on which WiFi it's connected to?
dhcpcd can configure interfaces dependent on the host network. This uses the Address Resolution Protocol (ARP) to probe hosts based on MAC or IP address before attempting DHCP resolution.
See Host Specific Configuration in How to set up networking/WiFi
go to dhcpcd.conf and edit IP address as per each wifi requirement and enable ARPing.
Try this way:
interface eth0 arping 192.168.2.1 arping 192.168.4.50 profile 192.168.2.1 static ip_address =192.168.2.44/24 static routers=192.168.2.1 static domain_name_servers=192.168.2.1 profile 192.168.4.50 static ip_address=192.168.0.44/24 static routers=192.168.4.50 static domain_name_servers=192.168.4.50