Skip to content

Commit 500ac2b

Browse files
committed
Only import SirRobin in __init__ if type checking
This ensure logging is setup properly at runtime before importing additional modules
1 parent c8500b9 commit 500ac2b

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

bot/__init__.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,14 @@
11
import asyncio
22
import os
3+
from typing import TYPE_CHECKING
34

45
from pydis_core.utils import apply_monkey_patches
56

6-
from bot.bot import SirRobin
77
from bot.log import setup_logging
88

9+
if TYPE_CHECKING:
10+
from bot.bot import SirRobin
11+
912
# On Windows, the selector event loop is required for aiodns.
1013
if os.name == "nt":
1114
asyncio.set_event_loop_policy(asyncio.WindowsSelectorEventLoopPolicy())

0 commit comments

Comments
 (0)