diff --git a/nbclient/client.py b/nbclient/client.py index bbd92d88..7df2a39a 100644 --- a/nbclient/client.py +++ b/nbclient/client.py @@ -467,7 +467,7 @@ async def async_execute(self, **kwargs): The executed notebook. """ reset_kc = kwargs.get('reset_kc', False) - if reset_kc: + if reset_kc and self.km: await self._async_cleanup_kernel() self.reset_execution_trackers()