https://kotlinlang.org logo
#getting-started
Title
# getting-started
r

Ray Rahke

03/16/2024, 6:46 PM
Is it not possible to put stuff in different files/subfolders and import them back into main, when doing KotlinJS? I have
src/main.kt
and
src/helpers/foo.kt
At the top of
foo.kt
I say
package helpers
, then in
main.kt
I do
import helpers
. I get
Copy code
Packages cannot be importedkotlin(PACKAGE_CANNOT_BE_IMPORTED)
d

Darryl Miles

03/16/2024, 6:50 PM
import helpers.foo
you are trying to import the package itself, not the class inside the package
y

Youssef Shoaib [MOD]

03/16/2024, 7:02 PM
If you want to import everything inside of it, you can do
import helpers.*
. If you just want to be able to write
helpers.foo(x)
, then no imports are needed, it just works!