code: def is_interactive_backend(backend):
      
      matplotlib = sys.modules['matplotlib']
      from matplotlib.rcsetup import interactive_bk, non_interactive_bk  # @UnresolvedImport
      if backend in interactive_bk:
          return True
      elif backend in non_interactive_bk:
          return False
      else:
          return matplotlib.is_interactive()
docs: Check if backend is interactive