diff --git a/py/mpconfig.h b/py/mpconfig.h
index 500af5e7646e2a76e33308ff977d3684955b4896..ad2fe3ee56ae7a5e386ae44437ffbc5cd97d5f1b 100644
--- a/py/mpconfig.h
+++ b/py/mpconfig.h
@@ -406,6 +406,11 @@ typedef double mp_float_t;
 #define MICROPY_STREAMS_NON_BLOCK (0)
 #endif
 
+// Whether to call __init__ when importing builtin modules for the first time
+#ifndef MICROPY_MODULE_BUILTIN_INIT
+#define MICROPY_MODULE_BUILTIN_INIT (0)
+#endif
+
 // Whether module weak links are supported
 #ifndef MICROPY_MODULE_WEAK_LINKS
 #define MICROPY_MODULE_WEAK_LINKS (0)
diff --git a/py/objmodule.c b/py/objmodule.c
index 940a8daf25e87049b9f6ef6016374cc0f938e9a4..63cccde2b2b094fecc02c98ac1cbe0758f570bb6 100644
--- a/py/objmodule.c
+++ b/py/objmodule.c
@@ -215,6 +215,17 @@ mp_obj_t mp_module_get(qstr module_name) {
         if (el == NULL) {
             return MP_OBJ_NULL;
         }
+
+        if (MICROPY_MODULE_BUILTIN_INIT) {
+            // look for __init__ and call it if it exists
+            mp_obj_t dest[2];
+            mp_load_method_maybe(el->value, MP_QSTR___init__, dest);
+            if (dest[0] != MP_OBJ_NULL) {
+                mp_call_method_n_kw(0, 0, dest);
+                // register module so __init__ is not called again
+                mp_module_register(module_name, el->value);
+            }
+        }
     }
 
     // module found, return it