title: Receive print content of another class at execution time not after the end of the function
body: <p>What I have tried:</p>
  <pre><code>import import_ipynb
  import time
  
  class A:
      def func1(self):
          for i in range(0, 5):
              print(i)
              time.sleep(1)
  
  class B:
      print('Time is:', A().func1())
  </code></pre>
  <p>In <code>class B</code> I want to get <code>print</code> content in <code>class A</code> and add <code>'Time is:'</code> to the beginning and print it in console. One solution is to return <code>i</code> as a list at the end of function, but I want <code>i</code> as instantaneous, not when the function is fully executed. The code I wrote does not do this correctly.<br />
  The output I want is:</p>
  <pre><code>Time is: 0
  Time is: 1
  Time is: 2
  Time is: 3
  Time is: 4
  </code></pre>