Custom evaluation function with more input parameters

Hi guy
I checked there are example on how to write custom evaluation functions.

for example
def evalerror(preds, dtrain):
…balabal

the default input are preds, dtrain. In fact I need another input parameters for example preds_weights which is pre-defined.
I am wondering any example to to this task.
I think the same question for custom obj function

thanks guys

Your custom eval function can refer to global variables.