jbuchermn / newm

Wayland compositor
MIT License
960 stars 30 forks source link

Split config #100

Closed fedoranvar closed 2 years ago

fedoranvar commented 2 years ago

Good day to you!

How to split config file into multiple files?

i've tried

from loca.script.path import *
...
exec(open("./local/script/path").read())

it didn't worked out

thank you!

jbuchermn commented 2 years ago

Yeah, Python imports are great...

The easiest way to do this is probably

import sys
sys.path.append("/home/.../.local/script/path")
from script_name import *

I just tried it and it works, only updates are not handled, probably you'd need to use importlib or del sys.modules[...] - check e.g. newms implementation in config.py