Im writing a program in php which does almost everything it needs to do, but at one point i need to use a function that is written in python using the mechanize library, both these scripts will be hosted on the same server.
My initial thoughts are to make a CURL call containing any arguments from the php script to the python script, and then return the results of the function again back to the php script using CURL.
Im quite new to programming and not sure of the best conventions when doing something like this, is my setout workflow using CURL the usual way this would be done or is there another way ?
If you need to be able to distribute the PHP code and the Python code independently, deploy them on separate servers, etc., then this is reasonable—you make the Python code a web service, make the PHP code call that web service, and you're done.

But if the Python script is always going to be running locally, it's usually easier just to run it as a program—pass it command-line arguments and/or standard input, and retrieve its standard output. PHP has a few different ways to do this—system, popen, exec, passthru—which all have different upsides and downsides.
For example, with exec, you just call escapeshellarg on each argument, put them together into a space-separated string with the path to the script, call exec, and you get the result back.
Calling a function in another lagnauge