title: Can we use composable functions from other classes inside another class?
body: <p>I am just practicing jetpack compose and trying to get used to it and I made a directory inside my app called Views and I am making different kotlin classes inside that directory each with a different composable function for different peices of my UI.  The problem is that I cannot call a composable function from a different kotlin file inside other ones.</p>
  <p>for example i have a class Ticket with composable TicketView function</p>
  <pre><code>class Ticket {
  
  @Composable
  fun TicketView(myTicket: MyTicket, winingTicket: WinningTicket, isActualTicket: Boolean, isPowerball: Boolean, numTicket: Int) {
      Column(
      ){
          if(isActualTicket) Text(&quot;Winning Ticket&quot;,fontSize = 25.sp) else Text(&quot;Ticket &quot; + numTicket,fontSize = 25.sp,)
          Row(modifier = Modifier.fillMaxWidth().background(color= Color.Black),verticalAlignment = Alignment.CenterVertically) {
              Box(modifier = Modifier.weight(1f).size(75.dp,75.dp)){
                  Image(painter = painterResource(id = if(myTicket.getNumber(0) == winingTicket.getNumber(0) &amp;&amp; !isActualTicket) R.drawable.ball1star else R.drawable.ball1),&quot;ball 1&quot;,modifier = Modifier.fillMaxSize())
                  Text(
                      if (isActualTicket) winingTicket.getNumber(0).toString() else myTicket.getNumber(0).toString(),
                      fontSize = 25.sp,
                      textAlign = TextAlign.Center,
                      style = TextStyle(textDecoration = TextDecoration.Underline),
                      fontWeight = FontWeight.Bold,
                      modifier = Modifier.fillMaxSize().paddingFromBaseline(top = 45.dp))
              }
              Box(modifier = Modifier.weight(1f).size(75.dp,75.dp)){
                  Image(painter = painterResource(id = if(myTicket.getNumber(1) == winingTicket.getNumber(1) &amp;&amp; !isActualTicket) R.drawable.ball1star else R.drawable.ball1),&quot;ball 2&quot;,modifier = Modifier.fillMaxSize())
                  Text(if (isActualTicket) winingTicket.getNumber(1).toString() else myTicket.getNumber(1).toString(),
                      fontSize = 25.sp,textAlign = TextAlign.Center,
                      style = TextStyle(textDecoration = TextDecoration.Underline),
                      fontWeight = FontWeight.Bold,
                      modifier = Modifier.fillMaxSize().paddingFromBaseline(top = 45.dp))
              }
              Box(modifier = Modifier.weight(1f).size(75.dp,75.dp)){
                  Image(painter = painterResource(id = if(myTicket.getNumber(2) == winingTicket.getNumber(2) &amp;&amp; !isActualTicket) R.drawable.ball1star else R.drawable.ball1),&quot;ball 3&quot;,modifier = Modifier.fillMaxSize())
                  Text(if (isActualTicket) winingTicket.getNumber(2).toString() else myTicket.getNumber(2).toString(),
                      fontSize = 25.sp,textAlign = TextAlign.Center,
                      style = TextStyle(textDecoration = TextDecoration.Underline),
                      fontWeight = FontWeight.Bold,
                      modifier = Modifier.fillMaxSize().paddingFromBaseline(top = 45.dp))
              }
              Box(modifier = Modifier.weight(1f).size(75.dp,75.dp)){
                  Image(painter = painterResource(id = if(myTicket.getNumber(3) == winingTicket.getNumber(3) &amp;&amp; !isActualTicket) R.drawable.ball1star else R.drawable.ball1),&quot;ball 4&quot;,modifier = Modifier.fillMaxSize())
                  Text(if (isActualTicket) winingTicket.getNumber(3).toString() else myTicket.getNumber(3).toString(),
                      fontSize = 25.sp,textAlign = TextAlign.Center,
                      style = TextStyle(textDecoration = TextDecoration.Underline),
                      fontWeight = FontWeight.Bold,
                      modifier = Modifier.fillMaxSize().paddingFromBaseline(top = 45.dp))
              }
              Box(modifier = Modifier.weight(1f).size(75.dp,75.dp)){
                  Image(painter = painterResource(id = if(myTicket.getNumber(4) == winingTicket.getNumber(4) &amp;&amp; !isActualTicket) R.drawable.ball1star else R.drawable.ball1),&quot;ball 5&quot;,modifier = Modifier.fillMaxSize())
                  Text(if (isActualTicket) winingTicket.getNumber(4).toString() else myTicket.getNumber(4).toString(),
                      fontSize = 25.sp,textAlign = TextAlign.Center,
                      style = TextStyle(textDecoration = TextDecoration.Underline),
                      fontWeight = FontWeight.Bold,
                      modifier = Modifier.fillMaxSize().paddingFromBaseline(top = 45.dp))
              }
              Box(modifier = Modifier.weight(1f).size(75.dp,75.dp)){
                  var id = R.drawable.power1
                  if(myTicket.getNumber(5) == winingTicket.getNumber(5) &amp;&amp; !isActualTicket){
                      if(isPowerball){
                          id = R.drawable.powerstar1
                      }else{
                          id = R.drawable.megastar1
                      }
                  }else{
                      if(isPowerball){
                          id = R.drawable.power1
                      }else{
                          id = R.drawable.mega1
                      }
                  }
                  Image(painter = painterResource(id =  id),&quot;powerball&quot;,modifier = Modifier.fillMaxSize())
                  Text(if (isActualTicket) winingTicket.getNumber(5).toString() else myTicket.getNumber(5).toString(),
                      fontSize = 25.sp,textAlign = TextAlign.Center,
                      style = TextStyle(textDecoration = TextDecoration.Underline),
                      fontWeight = FontWeight.Bold,
                      modifier = Modifier.fillMaxSize().paddingFromBaseline(top = 45.dp))
              }
              Box(modifier = Modifier.weight(2f).size(75.dp,75.dp)){
  
                  Text(winingTicket.calculateWin(myTicket.ticket!!, true),
                      color = Color.White,
                      fontSize = 20.sp,textAlign = TextAlign.Center,
                      style = TextStyle(textDecoration = TextDecoration.Underline),
                      fontWeight = FontWeight.Bold,
                      modifier = Modifier.fillMaxSize().paddingFromBaseline(top = 12.dp))
              }
  
  
  
  
          }
      }
  
  }
  
  @Preview(showBackground = true)
  @Composable
  fun DefaultPreview() {
      PowerMegaTheme {
          var myTicket = MyTicket()
          myTicket.ticket = &quot;1 2 12 4 5 6&quot;
          myTicket.multi = true;
          var winningTicket = WinningTicket()
          winningTicket.winningNumber = &quot;1 2 12 4 5 6&quot;
          winningTicket.multiplier = &quot;2&quot;
          TicketView(myTicket = myTicket, winingTicket = winningTicket,isActualTicket = true,isPowerball = true, numTicket = 1)
      }
  }
  </code></pre>
  <p>}</p>
  <p>and then i have a TicketCard class with TicketCard composable function that I would like to use the TicketView composable function in</p>
  <pre><code>class TicketCard {
  
  @Composable
  fun TicketCard(winningTicket: WinningTicket, myTickets: List&lt;MyTicket&gt;, isPowerball: Boolean){
      Card(){
          Text(winningTicket.date!!)
          var count = 1
          for(myTicket in myTickets){
              //I would like to use TicketView here
          }
  
      }
  }
  @Preview(showBackground = true)
  @Composable
  fun DefaultPreview() {
      PowerMegaTheme {
  
      }
  }
  </code></pre>
  <p>}</p>
  <p>I tried to import the class and It will just not let me do it. Maybe I am going about building my ui elements the wrong way.</p>
  <p>Thank you for your time.</p>