I did some research and found the information below. It took me a while to figure out that the issue is known in German as "Insichgeschäft". The quotes below are translations from Wikipedia.
The term self-dealing is also used in Switzerland. It is regulated in Art. 32 ff. OR.
The Federal Supreme Court has consistently ruled that self-contracting is fundamentally inadmissible because it “regularly leads to conflicts of interest and is therefore not covered by the company's purpose”. The contracting of the agent with himself should only be able to develop legal effects in exceptional cases, in particular if either the risk of the person represented being disadvantaged due to the nature of the legal transaction is excluded (e.g. "purchase of goods with clearly defined market or stock exchange prices"), or if the representative "specifically authorizes the representative to conclude a contract with himself, which in certain circumstances can also be tacit or approve the transaction retrospectively".
Now since I am the owner of the business and my company would get a free exclusive license, I assume that the above mentioned exceptional case is valid:
However, the risk of discrimination (and thus also the obligation to obtain approval from a higher-level or subsidiary body) does not apply if there are no other shareholders in the AG in addition to the body that has concluded self-contracting. The Federal Supreme Court has rejected the additional requirement that, in addition to the absence of further shareholders, there must also be no corporate creditors. Sole shareholders are therefore free to enter into individual deals.
Therefore, such a contract should be legally ok.
Finally, to be considered:
As part of the reform of the GmbH, the company law (Art. 718b OR), the GmbH law (Art. 814 Para. 4 OR) and the cooperative law (Art. 899a OR) introduced the requirement of written form for contracts that the representative of the company concludes with himself, with the exception of contracts which do not exceed CHF 1,000.