I have a raspberry pi in which Nginx is installed . I want to access it through the internet . I have set up port forwarding and i can access it through its public ip on my wifi (Pi is using the same network) but not when I and pi is on different networks. I have disabled firewall. My public ip starts with 172.35.x.xxx
If your IP starts with anything from 172.16.x.x to 172.31.x.x, that's not a public IP. That's a private IP that won't route past your firewall. You need the WAN IP address of your router.