R
R
Rustam Efimov2021-07-03 21:33:34
Python
Rustam Efimov, 2021-07-03 21:33:34

How to create a mod system for a game in Python?

I want to make it possible to create mods for my game, and I ask myself the question " How can I make it possible to import an entire function or def functions from a text file or a .py file? "
And also how to import variables from a .py file (this in case function import is not possible from .txt)?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
D
Daniil Shevkunov, 2021-07-03
@rus_07_tam

Well, if the game is in python, then the functions must be imported as
from mod_file import *
And for the person to choose which file to import from
. Variables are also imported

A
Antonio Solo, 2021-07-04
@solotony

importlib should help

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question