to_be_imported does not have a variable b. The only b in your program is local to func, and disappears when you exit the function. The canonical way to do this would be:
def func(a):
b = a + "!!!"
c = b + " Mike!!!"
print c
return b
...
from to_be_imported import *
local_b = func("hey")
There are other ways to do this. For instance, you could be make b a global variable of to_be_imported and then access it with something like
print to_be_imported.b
However, this is generally not a good idea. Also, note that it's not really a good idea to have a remote function both print output and return a value. Modules and passing information are really cool, but make sure you follow recommendations in the textbook or tutorials you're using, so you don't have debugging troubles later.
I got errorfuncreturnsNone, since you don't have an explicitereturnstatement. This, when you assignvar = func('hey'), thenvar == Noneand when you tryvar.byou'll get the error you are seeing. Furthermore, even ifvarwas notNone, you can't access the local variables infuncthat way, unless you do some hocus-pocus withlocals()and return that... but that sounds like a fundamental design issue with your code. In general, if you want some value inside some function, your function should return that value.