Please provide your pymavlink version and the output of master.mode_mapping().keys(), if possible, please provide a minimum example that replicates your problem.
If you want, if you set your mode as depth hold on qgroundcontrol, it works as depth hold when you start your autonomous code. (For this method you need to run your code on raspberry pi.)