def __init__(self, fname): data = load_json(open(fname).read()) topic = Comment(data[0]['data']['children'][0]) comments = [Comment(c) for c in data[1]['data']['children'] if 'body' in c['data']] topic.children = comments self.comment_tree = topic self.comment_list = flatten_comment_tree(self.comment_tree)