The judge will want you to get help with your drug use issues, but working within the requirements of the drug laws and procedures is the key to your court case. Depending on your circumstances, you may qualify for drug diversion or “Prop 36” treatment, which will require court and probation participation. Your program may or may not qualify. Unless the court orders you into a program you may not get full “credit” for it. There are ways an experienced criminal defense attorney can coordinate all of this, so it is best to work with him/her to receive the full benefit.