A
A
Alexey Guvgenovich2022-01-07 01:18:45
Python
Alexey Guvgenovich, 2022-01-07 01:18:45

How to call commands from another file?

I tried it didn't work out. I just need to take commands from 1 file and events from another. And if you can explain without any forums.

import discord
import os
import sys

sys.path.append(os.path.abspath('command'))
from global_sets import * # Импорт основных настроек
from config import command

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexander Ananchenko, 2022-01-07
@Shurik24

There is such an example, I have functions for commands in the core folder, I just write
import core.utils as command
and for example there is a registration command, I declare the register command and call command.reg ()
I saw cogs (cogs) somewhere but for sure I can't tell you how it works, look it up on Google

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question