CARVIEW |
Select Language
HTTP/2 200
date: Wed, 15 Oct 2025 20:35:22 GMT
server: Generic Web Server
content-location: ExecuteAPythonFileWithExternalEvaluate.html.en
vary: negotiate,accept-language
tcn: choice
set-cookie: WR_SID=1dfa07cd.6413870923431; path=/; max-age=315360000; domain=.wolfram.com
accept-ranges: bytes
content-type: text/html
content-language: en
content-security-policy: upgrade-insecure-requests
Execute a Python File with ExternalEvaluate—Wolfram Documentation
Execute a Python File with ExternalEvaluate
WORKFLOW
Execute a Python File with ExternalEvaluate
Start Python
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:
Notes
StartExternalSession is not supported in the Wolfram Cloud.