With Reference to pi-3
I have read the Webserver approach and have tried it. That just shows me the python code back on the browser, if I run "http://(Ip address of my Pi)/programme.py". Where the programme.py is in "www" folder of the web server.
I want that a programme that deals with controlling gpio pins according to my logic to be executed on the Pi remotely that is via the Internet and that too from an another python script that is executing on some other device connected to the Internet something like exec("the URL to the programme on Pi") and that programme on Pi gets executed where my Pi is connected to the Internet.
I have a python code on my Laptop and this laptop has an Internet connection. Now, have a Pi too and it has a python code that deals with controlling Gpio pins of the Pi and my Pi is also connected to the Internet. I will execute that code on the laptop manually but the code on Pi should get executed automatically by the code executing on the laptop with the help of the Internet since both the devices are connected to the Internet. Basically, It should be something like just a call to that code on Pi to get it executed. Here both the codes are Independent in functionality the only thing is one Python programme need to just start or Initiate the execution of the script on the Pi via Internet remotely.
Hope now it's clear!
Do not down vote I researched a lot to do this and tried much. Am quite new to Pi.