@@ -329,24 +329,26 @@ void Window::set_menu_actions() {
329329 Notebook::get ().get_view (c)->configure ();
330330 Notebook::get ().configure (c);
331331 }
332- auto file_path=view->file_path ;
333- while (file_path.has_parent_path ()){
334- auto parent=file_path.parent_path ();
335- if (parent==Config::get ().python .plugin_directory ){
336- auto stem=file_path.stem ().string ();
337- auto module =Python::get_loaded_module (stem);
338- module =module ? Python::reload (module ) : Python::import (stem);
339- if (module )
340- Terminal::get ().print (" Plugin `" +stem+" ` was reloaded\n " );
341- else {
342- if (Python::thrown_exception_matches (PyExc_SyntaxError))
343- Terminal::get ().print (Python::SyntaxError ());
344- else
345- Terminal::get ().print (Python::Error ());
332+ if (view->file_path .extension ().string ()==" .py" ){
333+ auto file_path=view->file_path ;
334+ while (file_path.has_parent_path ()){
335+ auto parent=file_path.parent_path ();
336+ if (parent==Config::get ().python .plugin_directory ){
337+ auto stem=file_path.stem ().string ();
338+ auto module =Python::get_loaded_module (stem);
339+ module =module ? Python::reload (module ) : Python::import (stem);
340+ if (module )
341+ Terminal::get ().print (" Plugin `" +stem+" ` was reloaded\n " );
342+ else {
343+ if (Python::thrown_exception_matches (PyExc_SyntaxError))
344+ Terminal::get ().print (Python::SyntaxError ());
345+ else
346+ Terminal::get ().print (Python::Error ());
347+ }
348+ break ;
346349 }
347- break ;
350+ file_path=parent ;
348351 }
349- file_path=parent;
350352 }
351353 }
352354 }
0 commit comments