How to create reusable Python component This follows from Garrett's fantastic answer here: In Python, given x-value on 2D Bezier Curve, return y-value

(EDIT: question generalised as per suggestion)

Say we have a Python file Foo.py containing the function X(p,q)

I would like to set things up so that my scripts can call X(...), rather than have to copy-paste its definition into each script that wants to invoke it.

How to accomplish this? And where is the right place to put Foo.py?
You could save the file into the site-packages directory, which is found by going to your Blender folder and then 2.70 > python > lib > python3.3 > site-packages.

Say your file is called "Foo.py" and has in it a function

def X(p,q):
    return p + q


then, after saving it into site-packages, in the Blender text editor or console, you could use:

from Foo import X