Hi @Endogen,
You can can control which axes a shape is attached to using the xref and yref properties under layout.shape. See https://plot.ly/python/reference/#layout-shapes-items-shape-xref.
I can’t tell how you made your subplot, but try setting xref to 'x' and 'x2' and yref to 'y' and 'y2' until it does what you want 
Hope that helps!
-Jon