Hi, so I have multiple trades open at the same time and I have this code:

#for long
order = self.MarketOrder(self.spy.Symbol, self.mysize * self.Portfolio.Cash / self.Securities[self.spy.Symbol].Price)
stop_loss_order = self.StopMarketOrder(self.spy.Symbol, -self.mysize * self.Portfolio.Cash / self.Securities[self.spy.Symbol].Price, sl1)
take_profit_order = self.LimitOrder(self.spy.Symbol, -self.mysize * self.Portfolio.Cash / self.Securities[self.spy.Symbol].Price, tp1)

#for short
order =self.MarketOrder(self.spy.Symbol, -self.mysize * self.Portfolio.Cash / self.Securities[self.spy.Symbol].Price)
stop_loss_order = self.StopMarketOrder(self.spy.Symbol, self.mysize * self.Portfolio.Cash / self.Securities[self.spy.Symbol].Price, sl1)
take_profit_order = self.LimitOrder(self.spy.Symbol, self.mysize * self.Portfolio.Cash / self.Securities[self.spy.Symbol].Price, tp1)

But if the stop loss is filled then is the take profit automatically cancelled? If not, which I think also that it does not cancel automatically, then how to cancel the take profit if the corresponding order's stop loss is filled and vice versa for long and short orders?

Please give some code for reference or is there a better way like:
self.buy(sl=sl1, tp=tp1, size=self.mysize)

where I can place a order and its stop loss and take profit at the same time in 1 order?