# Buggy code
def load_data(self, filename, ext):
    """Load data from filename"""
    from spyder_kernels.utils.iofuncs import iofunctions
    from spyder_kernels.utils.misc import fix_reference_name

    glbs = self._mglobals()

    load_func = iofunctions.load_funcs[ext]
    data, error_message = load_func(filename)

    if error_message:
        return error_message

    for key in list(data.keys()):
        new_key = fix_reference_name(key, blacklist=list(glbs.keys()))
        if new_key != key:
            data[new_key] = data.pop(key)

    try:
        glbs.update(data)
    except Exception as error:
        return str(error)

    return None


# Traceback (AttributeError)
File "/home/ok97465/anaconda3/lib/python3.7/site-packages/spyder/plugins/variableexplorer/widgets/namespacebrowser.py", line 444, in import_data
error_message = self.shellwidget.load_data(self.filename, ext)
File "/home/ok97465/anaconda3/lib/python3.7/site-packages/spyder/plugins/ipythonconsole/widgets/namespacebrowser.py", line 125, in load_data
timeout=CALL_KERNEL_TIMEOUT).load_data(filename, ext)
File "/home/ok97465/anaconda3/lib/python3.7/site-packages/spyder_kernels/comms/commbase.py", line 542, in __call__
call_dict, call_data, self._comm_id)
File "/home/ok97465/anaconda3/lib/python3.7/site-packages/spyder/plugins/ipythonconsole/comms/kernelcomm.py", line 114, in _get_call_return_value
call_dict, call_data, comm_id)
File "/home/ok97465/anaconda3/lib/python3.7/site-packages/spyder_kernels/comms/commbase.py", line 420, in _get_call_return_value
return self._sync_error(reply['value'])
File "/home/ok97465/anaconda3/lib/python3.7/site-packages/spyder_kernels/comms/commbase.py", line 480, in _sync_error
error_wrapper.raise_error()
File "/home/ok97465/anaconda3/lib/python3.7/site-packages/spyder_kernels/comms/commbase.py", line 90, in raise_error
raise self.etype(self)
Exception in comms call load_data:

File "/home/ok97465/anaconda3/lib/python3.7/site-packages/spyder_kernels/comms/commbase.py", line 342, in _handle_remote_call
buffer['call_kwargs'])

File "/home/ok97465/anaconda3/lib/python3.7/site-packages/spyder_kernels/comms/commbase.py", line 353, in _remote_callback
*call_args, **call_kwargs)

File "/home/ok97465/anaconda3/lib/python3.7/site-packages/spyder_kernels/console/kernel.py", line 257, in load_data
data[new_key] = data.pop(key)

AttributeError: 'NpzFile' object has no attribute 'pop'

# Fixed code
def load_data(self, filename, ext, overwrite=False):
    """
    Load data from filename.

    Use 'overwrite' to determine if conflicts between variable names need
    to be handle or not.

    For example, if a loaded variable is call 'var'
    and there is already a variable 'var' in the namespace, having
    'overwrite=True' will cause 'var' to be updated.
    In the other hand, with 'overwrite=False', a new variable will be
    created with a sufix starting with 000 i.e 'var000' (default behavior).
    """
    from spyder_kernels.utils.iofuncs import iofunctions
    from spyder_kernels.utils.misc import fix_reference_name

    glbs = self._mglobals()

    load_func = iofunctions.load_funcs[ext]
    data, error_message = load_func(filename)

    if error_message:
        return error_message

    if not overwrite:
        for key in data.keys():
            new_key = fix_reference_name(key, blacklist=list(glbs.keys()))
            if new_key != key:
                data[new_key] = data.pop(key)

    try:
        glbs.update(data)
    except Exception as error:
        return str(error)

    return None