What is the difference between 'Function' and 'role'?

A role is a function or part performed especially in a particular operation or process or context.

A function involves the things a person does in performing his/her role, for example, my role as teacher involves the following functions: instructing, nurturing, listening, encouraging, disciplining and empathizing with students.
what is the different between role and function