Scala import not working - object <name> is not a member of package, sbt preppends current package namespace in imports
scala
Solution
imports can be relative. Is that the only import you have? be careful with other imports like
`import com.me`
ultimately, this should fix it, then you can try to find more about it:
`import _root_.com.me.project.database.Database`
Problem
I have an issue when trying to import in scala. The object `Database` exists under `com.me.project.database` but when I try to import it: ``` import com.me.project.database.Database ``` I get the error: ``` object Database is not a member of package com.me.project.controllers.com.me.project.database ``` Any ideas what the problem is? Edit: It is worth mentioning that the import is in the file Application.scala under the package `com.me.project.controllers`, I can't figure out why it would append the import to the current package though, weird... Edit 2: So using: ``` import _root_.com.me.project.database.Database ``` Does work as mentioned below. But should it work without the `_root_`? The comments so far seem to indicate that it should. Answer: So it turns out that I just needed to clean the project for the import to work properly, using both: ``` import _root_.com.me.project.database.Database import com.me.project.database.Database ``` are valid solutions. Eclipse had just gotten confused.