Skip to content

[QUESTION]: How to import a class from a seperate script in a different script #214

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
CharGoldenYT opened this issue May 22, 2025 · 2 comments

Comments

@CharGoldenYT
Copy link

CharGoldenYT commented May 22, 2025

For my question, I'm looking for an answer relating to Funkin's API implementation, but I would also like tips on implementing this into my own API Handler as I'm making my own game.

The general idea is I have script A in one folder lets say [GameName]/mods/[ModA]/scripts/ScriptA.hxc and Script B in another folder in assets [GameName]/assets/scripts/ScriptB.hxc

and the code for Script B is

import gamename.backend.scripting.Script; // The import path for whatever the script extends, but will be represented as Script.
Class ScriptB extends Script
{
   public var someVariable:Bool = false;

   public function new() {
       super('ScriptB');
   }
}

But for Script A I want to import the ScriptB class, how would I do this?

@AbnormalPoof
Copy link

Simple: You can't

There is a PR (#201) to add this feature.

@CharGoldenYT
Copy link
Author

Well darn

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants