Do you have a code example or some more details on what your function does? Usually NonlinearModelFit can use almost any function you define previously or within NonlinearModelFit.
Did you hand over all relevant variables to the NonlinearModelFit-function?