I got no tips really. Your best bet is sobriety.
If that's not an option though (things happen, I get it), find a progressive social worker in your area if at all possible. Make sure you have emergency child care/a will/workable custody arrangements in place. Avoid entanglement in the legal system. Consume only at supervised sites. Have an emergency contact. And if you're on nicotine (which doesn't even get you high and carries the risk of 2nd hand smoke) quit that all together.
(I'm not a parent though so I guess take my words with a grain of salt).