run magic command code example
Example: use ipython magic in script
from IPython import get_ipython
ipython = get_ipython()
ipython.magic("timeit abs(-42)")
from IPython import get_ipython
ipython = get_ipython()
ipython.magic("timeit abs(-42)")