Your child is obliged to attend the religious education of his or her confession. In case the confessional education is not offered at a given school, the child has the right to attend religious education by another confession if the confessional authority agrees. If Your child does not attend religious education, he or she has to attend the subject Ethics. For further details, see http://www.gesetze-bayern.de/Content/Document/BaySchO2016-27