Historically modelines have opened up vim to security exploits, so the default is for modeline parsing to be disabled. You can check the status in vim with
:set modeline? modelines?
This is the default setting and can be overridden in your ~/.vimrc file like this
:set modeline modelines=20
Now a modeline appearing in a file will be parsed, so something I find useful for python scripts is: