I know that one can use a companion ojbect to declare static variables and functions for a Class in Scala, but is there a way to do declare static variables/funcions in a Trait?
No, you can't. Specially because Scala does not really has the concept of static, it only has values. Now, we all know that objects are compiled down to static fields, but that is just a runtime detail. - If you want something to be created only one time, you would need to define it on an object. On your trait you can have a reference to that val on that object if you want.
You can have a companion object for a trait in the same way that you have a companion object for a class.
So you can't declare static values inside the trait because Scala does not work that way, but you can achieve the same thing using the companion object.
objectsare compiled down to static fields, but that is just a runtime detail. - If you want something to be created only one time, you would need to define it on anobject. On your trait you can have a reference to that val on that object if you want.