One shot would "work", if that's the right word. A second shot?
It depends whether or not the slide can cycle. In all likelihood, the slide will rip thru a pocket lining and bind. Not only that, trying to fire from a pocket without raising it up will likely have you gripping the gun very high in an unusual way. You might injure your hand.
Buy a revolver if you want the capability of firing from a jacket pocket.