Execute a Python File with ExternalEvaluate
Python runs in an external session that must be started before you can evaluate Python code:
- If StartExternalSession returns an error, refer to the workflow Configure Python for External Evaluate.
Optionally load a Python file
Here is an example Python file with a function that prints a message in uppercase:
Load the file into the current external session:
Use the functions
Call Python functions with ExternalEvaluate. There are three ways to do this.
Use an association of named Python command-line elements:
Give Python code directly as a string:
Use a shorthand notation, with Python functions and arguments connected with arrows:
Terminate the session
Stop the external Python session:
StartExternalSession is not supported in the Wolfram Cloud.