Is there a Function to run an External swift code?

I am new to programming on swift…
and i want to know what the Function that Run/exec Another swift code…

i was a python programmer, And the Function that run/exec Another python code called : exec.
This is Example:
exec(“print(‘Hello world’)”)

  • Hello world.

Now is there same in swift?
im not talking about How to run app from Terminal!!
im talking about Function in that we can use on script