I have a script that checks for a certain condition (it checks if pip
dependencies are installed). If they are installed and everything is ok, I want to import a bunch of python functions from my plugin so they are available to the user. However, if it's not available, I just want to print a message and skip the rest of the script.
Now, I was thinking of wrapping the whole operation in a function with abort like this:
function! checkPipDeps() abort
...
if dependencyMissing
throw "Your dependency is missing"
endif
...
python3 import dependency
endfunction
checkPipDeps()
but this does look clunky. I was wondering if there is a better solution where I can just return a dud value or something, that would allow me to skip the rest of the script but not mess up the initial loading process.