Index: hierarchical_select.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/hierarchical_select/hierarchical_select.module,v
retrieving revision 1.161
diff -u -F^f -r1.161 hierarchical_select.module
--- hierarchical_select.module	6 Apr 2009 14:45:32 -0000	1.161
+++ hierarchical_select.module	18 Jul 2009 12:11:02 -0000
@@ -297,11 +297,23 @@ function hierarchical_select_json() {
     _hierarchical_select_log("hs_form_build_id: $hs_form_build_id");
   }
 
-  // Retrieve and process the form.
   $form_state = &$storage['parameters'][1];
+
+  // Include the file in which the form definition function lives.
   if (!empty($storage['file'])) {
     require_once($storage['file']);
   }
+
+  // Also include files set in $form_state['form_load_files']. Set by CTools
+  // Delegator, which is used by Panels (i.e. this is necessary for Panels
+  // compatibility).
+  if (isset($form_state['form_load_files'])) {
+    foreach ($form_state['form_load_files'] as $file) {
+      require_once './' . $file;
+    }
+  }
+
+  // Retrieve and process the form.
   $form = call_user_func_array('drupal_retrieve_form', $storage['parameters']);
   drupal_prepare_form($form_id, $form, $form_state);
   $form['#post'] = $_POST;
