In order to qualify as non-UK resident and income not being taxable in the UK, the HMRC residency criteria need to be met during a tax year.
If the contract starts/ends part way through a tax year, then ‘split-year treatment’ would be applied.
If the employer is UK based then a ‘no tax’ NT UK tax code can be obtained via form P85. Any duties performed in the UK may be treated as UK income.
Any investment income can be treated as ‘Disregarded income’ and you would not need to complete a UK self-assessment by virtue of the investment income.
However if you wish to complete a self-assessment in order to utilise the UK tax free personal allowance, then all UK sourced income would need to be included in the self-assessment.
If there is any UK rental income you can apply for this not to be taxed in the UK.
Please also be aware of mechanisms to avoid being taxed in both countries.
The HMRC comprehensive guidance on Residency is RDR3.