They technically can, but they would save it as a last resort. Even then, they may not do it.
I had a similar situation awhile back. Not sure what your med is, but understand your question. Agree with AJRC.....they are medical docs so sure they can prescribe meds.
The thing is, if it is a med generally not prescribed (head meds)....then believe they would refer you. No harm is asking.
Oh...the med I asked doc about was a muscle relaxant. I was sure it was better than any antidepressant. He did write a script to be taken with whatever antidepressant I was on at time....soon discovered that depression didn't go away with a good night's sleep and relaxation from back spasms:).
BTW: happy to respond to you ....but this is the agoraphobia forum. Seems your question might get more attention in the depression or anxiety forums.
I'm on many pschy. meds for depression and bipolar disorder and have been for the last 20 years. I've never taken hydrocodone and to my knowledge it is used for pain relief. I know some people experience depression due to chronic pain and in that case a p. doc may prescribe it to you. Sorry I couldn't be more helpful.