pythonxonsh

How to run a Python file in xonsh?


I would like to execute a Python file in xonsh, the same way as %run works in ipython. In particular, I would like all the global variables from the script to be available in xonsh after running the file. How to?


Solution

  • Since the xonsh language is a strict superset of the Python language, you can just source it:

    source myfile.py