diff --git a/hxpy/Python.hx b/hxpy/Python.hx
index fb3c896..587c83b 100644
--- a/hxpy/Python.hx
+++ b/hxpy/Python.hx
@@ -1,5 +1,7 @@
package hxpy;
+import cpp.Callable;
+
@:buildXml("")
@:include("Python.h")
@:keep
@@ -69,8 +71,8 @@ extern class Python
public static inline function runSimpleFile(filetoParse:String):Void {
@:privateAccess
File.runSimpleFile(filetoParse);
- }
-
+ }
+
/**
*Function for closing a Python instance.
*/
@@ -82,33 +84,34 @@ extern class Python
@:cppFileCode('
#define PY_SSIZE_T_CLEAN
#ifdef _DEBUG
- #undef _DEBUG
- #include
- #define _DEBUG
+ #undef _DEBUG
+ #include
+ #define _DEBUG
#else
- #include
+ #include
#endif
#include
#include
using std::string;
using namespace std;
')
+@:keep
class File {
/**
* Function for loading Python code from a file.
* @param filetoParse The path of your Python script. (eg: script.py)
*/
- private static function runSimpleFile(filetoParse:String) {
- untyped __cpp__('
- PyObject *obj = Py_BuildValue("s", filetoParse.c_str());
- FILE* PScriptFile = _Py_fopen_obj(obj, "r+");
- if(PScriptFile){
- PyRun_SimpleFile(PScriptFile, filetoParse);
- fclose(PScriptFile);
- }
- else{
- std::cout << "File Not Found!";
- }
- ');
- }
- }
\ No newline at end of file
+ private static function runSimpleFile(filetoParse:String) {
+ untyped __cpp__('
+ PyObject *obj = Py_BuildValue("s", filetoParse.c_str());
+ FILE* PScriptFile = _Py_fopen_obj(obj, "r+");
+ if(PScriptFile){
+ PyRun_SimpleFile(PScriptFile, filetoParse);
+ fclose(PScriptFile);
+ }
+ else{
+ std::cout << "File Not Found!";
+ }
+ ');
+ }
+}
\ No newline at end of file
diff --git a/test/demos/extending python/src/Main.hx b/test/demos/extending python/src/Main.hx
index 6a3487b..240c4be 100644
--- a/test/demos/extending python/src/Main.hx
+++ b/test/demos/extending python/src/Main.hx
@@ -1,14 +1,14 @@
package;
import hxpy.Python;
-import hxpy.Python.File;
+import hxpy.Python;
class Main {
public static function main():Void {
//initializes the python instance
Python.initialize();
- //runs code path to script file
- File.runSimpleFile("script.py");
+ //runs code path to script file
+ Python.runSimpleFile("script.py");
//closes the python instance
Python.finalize();
}