Importing and Executing Python Code From Steve

To include a Python file from a steve simulation file, simply use an "@include" statement with the name of the Python file, just as steve files are included.

To use a Python class from a steve file, simply create a new instance of the class exactly as you would with a steve object. Likewise, methods can be called in the new object exactly as usual. Because of differences between the two languages, there are a few minor differences in calling objects over the bridge:

  • Keywords are ignored for arugment passing. Instead, arguments are expected in the order they are defined for a method. When calling Python methods from steve, you can use made-up keyword names (to preserve the normal steve syntax), but be sure to match the argument order of the python method.
  • steve uses the "-" (dash) character in many method names, but Python does not allow this character in method names. If calling a steve method from Python, use the "_" (underscore) character in place of "-". The character will be converted automatically.