Is it possible to get “importing module” in “imported module” in Python?

前端 未结 4 2014
暖寄归人
暖寄归人 2021-01-15 11:52

For imported module, is it possible to get the importing module (name)? I\'m wondering if inspect can achieve it or not~

4条回答
  •  北荒
    北荒 (楼主)
    2021-01-15 12:31

    Even if you got it to work, this is probably less useful than you think since subsequent imports only copy the existing reference instead of executing the module again.

提交回复
热议问题