from multiprocessing import Process

if __name__ == "__main__":
  def hoge():
    print("ok")
  p = Process(target=hoge)
  p.start() # AttributeError: Can't get attribute 'hoge' on ....

↑動かない

def hoge():
  print("ok")

if __name__ == "__main__":
  p = Process(target=hoge)
  p.start()

↑これなら動く

なんでこうなるん?