Praise be to Allah.
We put this question to our shaykh, Muhammad ibn Saalih al-‘Uthaymeen (may Allah preserve him), who answered as follows:
I seek refuge with Allah! This is worse than committing sin openly, because in addition to committing sin openly, it is giving a bad upbringing.
Question: If he does it inside his own house and not in front of people, will he still be counted as is committing sin openly?
Answer: If he were to do it in his own room on his own, we would not say that this committing sin openly, but the fact that he is doing it in front of his children means that he is giving them a bad upbringing as well as committing sin openly. Hence smokers must not smoke in front of their children, because by doing so they are teaching them to smoke.
And Allah knows best.