def _call_udf(self, method_name, **kwargs):

        # get the custom function
        try:
            func = self._custom_functions[method_name]
        except KeyError:
            return []

        # clear any MPL artists created on last call
        if self.remove_artists:
            layer = kwargs.get('layer', None)
            key = (layer, method_name)
            old = self._created_artists.get(key, set())
            remove_artists(old)
            current = all_artists(self.axes.figure)

        # add some extra information that the user might want
        kwargs.setdefault('_self', self)
        kwargs.setdefault('axes', self.axes)
        kwargs.setdefault('figure', self.axes.figure)
        kwargs.setdefault('state', self.state)

        # call method, keep track of newly-added artists
        settings = SettingsOracle(self._settings, **kwargs)
        result = introspect_and_call(func, settings)

        if self.remove_artists:
            new = new_artists(self.axes.figure, current)
            self._created_artists[key] = new
            if new:
                self.axes.figure.canvas.draw()
        else:
            self.axes.figure.canvas.draw()

        return result
Call a user-defined function stored in the _custom_functions dict
dataset/ETHPy150Open glue-viz/glue/glue/viewers/custom/qt/custom_viewer.py/CustomViewer._call_udf