project/ ├── src/ │ └── Main.hx │ ├── bin/ │ └── python/ │ └── build.hxml2. Insert the following code into the
src/Main.hx
file:class Main { static function main() { Sys.println("Haxe is great!"); } }3. Add the following build configuration into the
build.hxml
file:-cp src -main Main -python bin/python/main.pyThe configuration above specifies that your source code is stored in
src/
, that your main Haxe file is src/Main.hx
, and that you want Haxe to output the Python source code into bin/python/
.
python --version
or python3 --version
.python
, you have an issue with your installation or python
is not added into the PATH
environment variable.Python 3.7.2
Browse the Haxe API website for the core Haxe APIs that you can use in your project.
You can use Python-specific APIs in addition to the core Haxe APIs.
Browse the haxelib website for community-developed libraries that you can add to your project.
You can install haxelib libraries globally by running haxelib install <library>
.
You can specify that your project uses a haxelib by adding -lib <library>
to your .hxml
file.
Build your Haxe project by running haxe build.hxml
in a console in your project directory.
This compiles your .hx
source code into Python scripts which you can run and debug next.
After compiling your project with Haxe, you'll need to open a console in the bin/python
directory and run the command python main.py
.
You can alternatively use a full-fledged Python IDE like the ones given below to run and debug your program.
If you need help with anything, visit the vibrant Haxe community and simply ask for help with the details of your project. We have a helpful and active community and you should get your answers quickly!