In your example you use the following code:
bp.save_bi_clusters_as_xml(filename,bi_clusters, obj_val, is_optimal, instance)
But since save_bi_clusters_as_xml it not in __init__.py, this produces an error.
So you either need to write:
bp.main.save_bi_clusters_as_xml(filename,bi_clusters, obj_val, is_optimal, instance)
or add the function to __init__.py