Gambling is not an investment. Investment is an investment of funds for the purpose of making a profit.
The investor always has a well-grounded plan according to which he will make a profit. This plan is based on mathematical and economic calculations. The investor controls the process of making a profit. He doesn't rely on luck.
Gambling is a direct interaction with chance (luck, fate). The player has no control over the end result of the gambling game.
This is the key difference between investment and gambling.
you are right, there are crossovers in term of risk management and managing bankroll but mindsets are really different
investors usually think about the downsides too and are prepared in case of losses, something that gamblers should do
as mentioned many times here: planning a max amount to lose is quite helpful.
I do consider the chance of losing although I'm very optimistic when I'm gambling. As they say, bet what you can afford to lose only, we should strictly follow that rules as that's for our own good only. We can aim for a bigger winning but we should do it slowly and consistently, if we are good enough unlike the majority of gamblers, then eventualyl we will reach to the point that we become successful.