This function implements loading a Python file and populating a new
        empty layer (Layer) with its contents

        :param filename: The name of a file to read
        :type filename: string

def add_layer_from_py_file(self, filename):
        """This function implements loading a Python file and populating a new
        empty layer (Layer) with its contents

        :param filename: The name of a file to read
        :type filename: string
        """
        if filename.endswith('.py'):
            try:
                path, filename = os.path.split(os.path.abspath(filename))
                sys.path.append(path)
                filename = filename.rsplit('.', 1)[0]
                stack = __import__(filename, fromlist=['*'],)
            except ImportError:
                logging.info("Could not import stack from %s" % filename)
                return

            self.add_layer()
            for attribute in dir(stack):
                setattr(self, attribute, getattr(stack, attribute))
            sys.path.pop()
            del sys.modules[filename]
            del stack