@@ -290,24 +290,26 @@ void Window::set_menu_actions() {
290290 Notebook::get ().get_view (c)->configure ();
291291 Notebook::get ().configure (c);
292292 }
293- auto file_path=view->file_path ;
294- while (file_path.has_parent_path ()){
295- auto parent=file_path.parent_path ();
296- if (parent==Config::get ().python .plugin_directory ){
297- auto stem=file_path.stem ().string ();
298- auto module =Python::get_loaded_module (stem);
299- module =module ? Python::reload (module ) : Python::import (stem);
300- if (module )
301- Terminal::get ().print (" Plugin `" +stem+" ` was reloaded\n " );
302- else {
303- if (Python::thrown_exception_matches (PyExc_SyntaxError))
304- Terminal::get ().print (Python::SyntaxError ());
305- else
306- Terminal::get ().print (Python::Error ());
293+ if (view->file_path .extension ().string ()==" .py" ){
294+ auto file_path=view->file_path ;
295+ while (file_path.has_parent_path ()){
296+ auto parent=file_path.parent_path ();
297+ if (parent==Config::get ().python .plugin_directory ){
298+ auto stem=file_path.stem ().string ();
299+ auto module =Python::get_loaded_module (stem);
300+ module =module ? Python::reload (module ) : Python::import (stem);
301+ if (module )
302+ Terminal::get ().print (" Plugin `" +stem+" ` was reloaded\n " );
303+ else {
304+ if (Python::thrown_exception_matches (PyExc_SyntaxError))
305+ Terminal::get ().print (Python::SyntaxError ());
306+ else
307+ Terminal::get ().print (Python::Error ());
308+ }
309+ break ;
307310 }
308- break ;
311+ file_path=parent ;
309312 }
310- file_path=parent;
311313 }
312314 }
313315 }
0 commit comments