Any time is a good time for tax planning, but the best time is as early as possible, preferably before coming to Portugal and before having a NIF issued.
People who are coming to Portugal with a certain business structure will very rarely be doubted, even if the structure is highly efficient from a tax perspective. People who change structures will often be questioned by the tax authorities. Changing structures after coming to Portugal is not impossible, but it's much harder than doing it early.
More on this here