Updating a field in another form when changes occur in current form

Updating a field in another form when changes occur in current form

I have two forms that are linked via a lookup field.

One of the forms is called Add_a_Class and the field is called "Students". The other form is called Add_a_Student and the field is called "Enrolled_Classes"

In my Add_a_Class form, I also have a field called "Number_of _Students_Enrolled". I currently have a workflow on User Input of the "Students" field that Inputs the "Number_of_Students_Enrolled" field:
input.Number_of_Students_Enrolled = input.Students.size();

I would also like to create a workflow for my Add_a_Student form on User Input of the "Enrolled_Classes" field to update the "Number_of_Students_Enrolled" field in my Add_a_Class form. 

Could anyone assist me with how I would write this script?

Thank you!