We construct a certain completion $C^\infty_\mathfrak{g}$ of the universal enveloping algebra of a triangular real Lie algebra $\mathfrak{g}$. It is a FreĚchet-Arens-Michael algebra that consists of elements of polynomial growth and satisfies to the following universal property: every Lie algebra homomorphism from $\mathfrak{g}$ to a real Banach algebra all of whose elements are of polynomial growth has an extension to a continuous homomorphism with domain $C^\infty_\mathfrak{g}$. Elements of this algebra can be called functions of class $C^\infty$ in non-commuting variables. The proof is based on representation theory and employs an ordered $C^\infty$-functional calculus. Beyond the general case, we analyze two simple examples. As an auxiliary material, the basics of the general theory of algebras of polynomial growth are developed. We also consider local variants of the completion and obtain a sheaf of non-commutative functions on the Gelfand spectrum of $C^\infty_\mathfrak{g}$ in the case when $\mathfrak{g}$ is nilpotent. In addition, we discuss the theory of holomorphic functions in non-commuting variables introduced by Dosi and apply our methods to prove theorems strengthening some his results.