I have data on biological species (observations) with certain ecological traits (variables) and I am interested in estimating some effects with instrumental variables. I am aware of the conventional method of Two-Stage Least Squares for this goal. However, the observations (species) are not independent as they are related through shared ancestry, and thus model residuals have phylogenetic autocorrelation. I know how to use Generalized Least Squares (GLS) to control for phylogenetic autocorrelation in a linear model, but I have not found any application of this in the framework of instrumental variables. Can I use GLS as in Two-Stage Least Squares to use instrumental variables while also accounting for autocorrelation? Would the resulting estimate have the same properties? If not, would there be some alternative for this goal?