How to load the current entity object (Profile 2)
I couldn't get menu_get_object to work with profile2 so instead I used a combination of profile2_load_by_user and arg suggested by Clive.

function mymodule_form() {
   //this arg gets the UID from the URL.
    $testarg = arg(1);

  //The UID is then put into a profile2 defined function which locates and opens the
  //correct profile.
    $currentprofile = profile2_load_by_user($testarg);
}