Your brief question leaves many unaddressed variables. That you desire sex might be considered a positive thing in the wake (no cheap pun intended) of your loss. Yet, if you have used sex in the past as an escape, rather than as a means to contributing to a mutual, respectful, and equal relationship, you will be furthering behavior that is ultimately destructive for you. Then, if you adhere to a faith tradition which precludes you from engaging in sex outside of marriage, you might find some short-term relief in sexual behavior, but you will ultimately self-inflict emotional and spiritual discord.
But I will assume you, an adult who has endured a significant loss, are understandably reaching out for love and affection.
1. You are not betraying the deceased.
2. You and your faith tradition decide on when is acceptable to you to have sex (it is not up to anyone else).
3. You will take into account that sexual behavior is never purely recreational.
It is impossible to do something so profoundly intimate with your body that doesn’t also impact every other aspect of your emotional and spiritual life.