How to memorize the waypoints traveled with dronekit

I’m give the rover to mission. On the way, I press a button as if it saw an obstacle and it stops. I set a new path and when I run the code again I get an error. I wrote the code using Dronekit. Even if I make sure it doesn’t get this error, it goes back to the first point and starts again because it starts the new mission. How can I keep in mind the destinations and resume the mission. Or how can I code it without reloading the mission?
Error: Traceback (most recent call last): File "/home/jungo/.local/lib/python3.6/site-packages/pynput/_util/", line 228, in inner return f(self, *args, **kwargs) File "/home/jungo/.local/lib/python3.6/site-packages/pynput/_util/", line 470, in _handler self._handle(self._display_stop, event) File "/home/jungo/.local/lib/python3.6/site-packages/pynput/keyboard/", line 564, in _handle self.on_press(key) File "/home/jungo/.local/lib/python3.6/site-packages/pynput/_util/", line 144, in inner if f(*args) is False: File "", line 180, in on_press save_mission(export_mission_filename) File "", line 34, in save_mission for cmd in missionlist: TypeError: 'NoneType' object is not iterable