code: def patch_is_interactive():
      
      matplotlib = sys.modules['matplotlib']
  
      def patched_is_interactive():
          return matplotlib.rcParams['interactive']
  
      matplotlib.real_is_interactive = matplotlib.is_interactive
      matplotlib.is_interactive = patched_is_interactive
docs: Patch matplotlib function 'use'