Handle AttributeError also when importing segment function