def loading(): global f_map global user_coords x = 0 friends = twitterAPI.json_get_user_friend_info(name, int(number)) for i in friends: x += 1 # find all friends print(x, "of", number) friend_coord, js, status = MapGenerator.create_friend_marker(i) MapGenerator.add_marker(f_map, friend_coord, js, status=status) MapGenerator.add_line(f_map, [user_coords, friend_coord]) f_map.save('templates\\Map.html') htmlEditor.edit_map('templates\\Map.html', htmlEditor.header) return render_template("Map.html", User="******"+name)