Python - Maple Programming Help

Online Help

All Products    Maple    MapleSim


Home : Support : Online Help : Connectivity : Python : Python/ImportModule

Python

  

ImportModule

  

import a module in the Python environment

 

Calling Sequence

Parameters

Description

Examples

Compatibility

Calling Sequence

ImportModule(package)

Parameters

package

-

string or sequence of strings

Description

• 

The ImportModule command is used to import modules in the Python environment.

• 

When package is a simple name, ImportModule(package) is equivalent to EvalString("import package",'output'='none').  

• 

When package already contains the string "import", usually as part of a more complicated import directive, then ImportModule(cmd) is the same as EvalString(cmd,output=none).

• 

This function is part of the Python package, so it can be used in the short form ImportModule(..) only after executing the command with(Python). However, it can always be accessed through the long form of the command by using Python[ImportModule](..).

Examples

withPython:

ImportModulestatistics

EvalStringstatistics.mean([1,2,3])

2

(1)

ImportModulemath as M

EvalStringM.sin(0)

0.

(2)

ImportModulefrom bs4 import BeautifulSoup

Compatibility

• 

The Python[ImportModule] command was introduced in Maple 2018.

• 

For more information on Maple 2018 changes, see Updates in Maple 2018.

See Also

Python

Python:-EvalString