On the search for the mechanism of photoreactions of some heterocyclic compounds