Perhaps there is a different way of going about this problem, but I am fairly new to using Django.
I have written a custom python script and would like to run a function
What @SwankSwashbucklers says is the way to go.
If you also want to maintain your script separate from the view, you can also use a custom management command and use call_command to call it in the view. This way you can run the script from the command line as well with manage.py mycommand [myargument].