I also suggest to add
%matplotlib inline %load_ext autoreload %autoreload 2
to the head of py file in case "Open as a Jupyter Notebook" not responding