code: def OnImport(self, event):
          
  
          # Get filepath from user
  
          wildcards = get_filetypes2wildcards(["csv", "txt"]).values()
          wildcard = "|".join(wildcards)
  
          message = _("Choose file to import.")
          style = wx.OPEN
          filepath, filterindex = \
              self.interfaces.get_filepath_findex_from_user(wildcard, message,
                                                            style)
  
          if filepath is None:
              return
  
          # Get generator of import data
          import_data = self.main_window.actions.import_file(filepath,
                                                             filterindex)
  
          if import_data is None:
              return
  
          # Paste import data to grid
          grid = self.main_window.grid
          tl_cell = grid.GetGridCursorRow(), grid.GetGridCursorCol()
  
          grid.actions.paste(tl_cell, import_data)
  
          self.main_window.grid.ForceRefresh()
docs: File import event handler