is one sinning if one knows the ruling, such as knowing a certain act is a sin but then does the certain act while forgetting that it is a sin and then realises and stops.
Bismillahir Rahmaanir Raheem
Al Jawaab Billahit-Tawfeeq
A sin comitted in the state of forgetfulness is fogiven, if the person stops committing it as soon as they realise and seeks repentence; and the sin does not violate the rights of any person.
The sin will be accounted for if the person continues to commit it after realising.