Assuming that the function useful_function is in a file foreign_code.py in the same directory as your program file, just put
from foreign_code import useful_function
at the top of your program.
Assuming that the function useful_function is in a file foreign_code.py in the same directory as your program file, just put
from foreign_code import useful_function
at the top of your program.