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/__init__.py", line 228, in inner return f(self, *args, **kwargs) File "/home/jungo/.local/lib/python3.6/site-packages/pynput/_util/xorg.py", line 470, in _handler self._handle(self._display_stop, event) File "/home/jungo/.local/lib/python3.6/site-packages/pynput/keyboard/_xorg.py", line 564, in _handle self.on_press(key) File "/home/jungo/.local/lib/python3.6/site-packages/pynput/_util/__init__.py", line 144, in inner if f(*args) is False: File "mission_basic.py", line 180, in on_press save_mission(export_mission_filename) File "mission_basic.py", line 34, in save_mission for cmd in missionlist: TypeError: 'NoneType' object is not iterable