   [module housekeeping-fn]
   (let [devs (doall (get (devices-in-each-module) module))
         dev-settings-map (zipmap devs
-                                 (doall (map read-device-startup-settings devs)))]
+                                 (doall (map read-device-startup-settings devs)))
+        ports (set (remove nil? (map :port (vals dev-settings-map))))]
     (core unloadLibrary module)
     (housekeeping-fn)
+    (dorun (map reload-device ports))
     (doseq [dev devs]
       (startup-device dev (dev-settings-map dev)))))
 

  (dotimes [i (count labels)]
      (core defineStateLabel dev i (get labels i))))

(defn read-device-startup-settings
  [dev]
  {:library-location (device-library-location dev)
   :pre-init-settings (pre-init-property-settings dev)
   :state-labels (state-device-labels dev)})

(defn startup-device
  "Startup a device given a device startup settings map."

  (:import (javax.swing JLabel JWindow)
           (java.awt Color)))

(load-mm (org.micromanager.MMStudioMainFrame/getInstance))

(defn devices-in-each-module
