import data_loading_utils.py file_name = 'file_name.ext' CHUNK_SIZE = 1000000 # configure this variable depending on your machine's hardware configuration # callback method def process_lines(data, eof, file_name): # check if end of file reached if not eof: # process data, data is one single line of the file else: # end of file reached if __name__ == "__main__": data_loading_utils.read_lines_from_file_as_data_chunks(file_name, chunk_size=CHUNK_SIZE, callback=self.process_lines) # process_lines method is the callback method. # It will be called for all the lines, with parameter data representing one single line of the file at a time