MBP 2017 w/ Touch Bar: How to turn off internal display & use external display instead
I have tried this as well with no luck for several months, then connected to docks and still stuck with internal display to be on.

Then I tried the hedge dock and similar and works well but using an external Apple Key and Mouse was my only solution.

I do know the Windows PC have that certain function and only seen it on older macs with Function keys nothing yet on MBP2016 and later w/TB

I would figure there must be a way via a terminal command.