What happens if you import a same module in Python twice and the module contains code print("hello")?

Experience Level: Junior
Tags: Python

Answer

The message "hello" will be displayed only once because the module loads only once even if it was imported multiple times.
Python for beginners
Python for beginners

Are you learning Python ? Try our test we designed to help you progress faster.

Test yourself