Haxe Target-Specific Getting-Started Tutorials

Using Python modules in a Haxe project

You have a Haxe project and would like to use an existing Python module in it.

To do that, you’ll be using haxe to compile your Haxe code to Python, then running it all on the Python VM. This is to say, your Haxe project will be targetting the Python platform.

To make use of Python modules from your Haxe program, you’ll need to use externs; this means writing up some simple scaffolding that show haxe what the modules you’re going to be calling out to look like.

Using Python Standard-Library Modules

See examples in https://github.com/HaxeFoundation/haxe/tree/development/std/python/lib.


Using 3rd-Party Python Modules