diff --git a/src/blueapi/client/client.py b/src/blueapi/client/client.py index 417d7df01..f97d3b7d5 100644 --- a/src/blueapi/client/client.py +++ b/src/blueapi/client/client.py @@ -3,6 +3,7 @@ import time from collections.abc import Iterable from concurrent.futures import Future +from contextlib import suppress from functools import cached_property from itertools import chain from pathlib import Path @@ -661,6 +662,11 @@ def reload_environment( try: status = self._rest.delete_environment() + # clear the cached plans/devices as they may have changed + with suppress(AttributeError): + del self.plans + with suppress(AttributeError): + del self.devices except Exception as e: raise BlueskyRemoteControlError( "Failed to tear down the environment"