diff --git a/src/modules/Makefile b/src/modules/Makefile
index 5053da0a9c0..605573b9867 100644
--- a/src/modules/Makefile
+++ b/src/modules/Makefile
@@ -23,7 +23,7 @@ endif
 all: helloworld.so hellotype.so helloblock.so hellocluster.so hellotimer.so hellodict.so hellohook.so helloacl.so helloscripting.so
 
 .c.xo:
-	$(CC) -I. $(CFLAGS) $(SHOBJ_CFLAGS) -fPIC -c $< -o $@
+	$(CC) -I.. -I. $(CFLAGS) $(SHOBJ_CFLAGS) -fPIC -c $< -o $@
 
 helloworld.xo: ../valkeymodule.h
 
diff --git a/src/modules/helloscripting.c b/src/modules/helloscripting.c
index 77c9843e3cd..481de010a18 100644
--- a/src/modules/helloscripting.c
+++ b/src/modules/helloscripting.c
@@ -1,4 +1,4 @@
-#include "../valkeymodule.h"
+#include "valkeymodule.h"
 
 #include <string.h>
 #include <ctype.h>
diff --git a/tests/modules/Makefile b/tests/modules/Makefile
index 1690b9b627d..3ece6f96034 100644
--- a/tests/modules/Makefile
+++ b/tests/modules/Makefile
@@ -64,7 +64,8 @@ TEST_MODULES = \
     moduleauthtwo.so \
     rdbloadsave.so \
     crash.so \
-    cluster.so
+    cluster.so \
+    helloscripting.so
 
 .PHONY: all
 
diff --git a/tests/modules/helloscripting.c b/tests/modules/helloscripting.c
new file mode 120000
index 00000000000..b35cd02ee6c
--- /dev/null
+++ b/tests/modules/helloscripting.c
@@ -0,0 +1 @@
+../../src/modules/helloscripting.c
\ No newline at end of file
diff --git a/tests/unit/moduleapi/scriptingengine.tcl b/tests/unit/moduleapi/scriptingengine.tcl
new file mode 100644
index 00000000000..404955aded5
--- /dev/null
+++ b/tests/unit/moduleapi/scriptingengine.tcl
@@ -0,0 +1,30 @@
+set testmodule [file normalize tests/modules/helloscripting.so]
+
+set HELLO_PROGRAM "#!hello name=mylib\nFUNCTION foo\nARGS 0\nRETURN\nFUNCTION bar\nCONSTI 432\nRETURN"
+
+start_server {tags {"modules"} overrides {{save ""}}} {
+    r module load $testmodule
+
+    r function load $HELLO_PROGRAM
+
+    test {Call scripting engine function: calling foo works} {
+        set result [r fcall foo 0 134]
+        assert_equal $result 134
+    }
+
+    test {Call scripting engine function: calling bar works} {
+        set result [r fcall bar 0]
+        assert_equal $result 432
+    }
+
+    test {Replace function library and call functions} {
+        set result [r function load replace "#!hello name=mylib\nFUNCTION foo\nARGS 0\nRETURN\nFUNCTION bar\nCONSTI 500\nRETURN"]
+        assert_equal $result "mylib"
+
+        set result [r fcall foo 0 132]
+        assert_equal $result 132
+
+        set result [r fcall bar 0]
+        assert_equal $result 500
+    }
+}