I have an pi connected to a machine, i can access the machine from a PC which is connected to the LAN, if i use my static IP i can access the machine from anywhere, but the problem is, An LAN with static IP will not be available everywhere, so is there any way to connect that raspberry pi even if i use a network like mobile hotspot without static IP?
Raspberry pi team suggests using weaved for accessing your pi remotely.
Check this link
You need install waved client in your machine and use weaved account to connect to your pi.
You can use a service like noip.com.
Sign up for an account, install the program on your raspberry pi so that it can track the ip address as it changes. Then when you log in with ssh, use the noip supplied address instead of your ip address.
You may need to forward port 22 to your Raspberry Pi's local ip address on your router too.
Try port forwarding or DMZ. You will need a router for this.
Edited: To overcome dynamic address, you may want to use Dynamic DNS. But, you will need a domain for this. I use Cloudflare to manage my domain names and use this tutorial to update domain record periodically to my public address. There are some alternative, such as freedns.afraid.org or maybe Ngrok, please suit your need.
And don't forget to forward the port.