Changing the relative import in core.py to use an absolute import path:

from videoarchiver.utils import progress_tracker
Updated the main init.py to properly handle module reloading:
Added 'videoarchiver.processor' and 'videoarchiver.processor.core' to modules_to_reload
Added explicit import and reload of the processor module
These changes ensure that:

The progress_tracker is properly imported from the utils package
All necessary modules are reloaded during initialization
Circular imports are avoided
The package structure maintains proper dependency flow
This commit is contained in:
pacnpal
2024-11-17 01:29:00 +00:00
parent b10722f05b
commit 247381fc8a
2 changed files with 7 additions and 1 deletions

View File

@@ -11,6 +11,8 @@ from redbot.core.bot import Red
modules_to_reload = [ modules_to_reload = [
'videoarchiver.utils.exceptions', 'videoarchiver.utils.exceptions',
'videoarchiver.utils', 'videoarchiver.utils',
'videoarchiver.processor',
'videoarchiver.processor.core',
'videoarchiver.core.commands.settings_commands', 'videoarchiver.core.commands.settings_commands',
'videoarchiver.core.commands.archiver_commands', 'videoarchiver.core.commands.archiver_commands',
'videoarchiver.core.commands.database_commands' 'videoarchiver.core.commands.database_commands'
@@ -25,6 +27,10 @@ for module in modules_to_reload:
from . import utils from . import utils
importlib.reload(utils) importlib.reload(utils)
# Import and reload processor
from . import processor
importlib.reload(processor)
from .core.base import VideoArchiver from .core.base import VideoArchiver
from .core.initialization import initialize_cog, init_callback from .core.initialization import initialize_cog, init_callback
from .core.cleanup import cleanup_resources from .core.cleanup import cleanup_resources

View File

@@ -10,7 +10,7 @@ from discord.ext import commands
from .message_handler import MessageHandler from .message_handler import MessageHandler
from .queue_handler import QueueHandler from .queue_handler import QueueHandler
from ..utils import progress_tracker from videoarchiver.utils import progress_tracker
from .status_display import StatusDisplay from .status_display import StatusDisplay
from .cleanup_manager import CleanupManager, CleanupStrategy from .cleanup_manager import CleanupManager, CleanupStrategy
from .constants import REACTIONS from .constants import REACTIONS