Dynamically loading subpackages

Please post any questions about developing your plugin here. Please use the search function before posting!
arawra
Senior Member
Posts: 190
Joined: Fri Jun 21, 2013 6:51 am

Dynamically loading subpackages

Postby arawra » Mon Sep 07, 2020 8:19 am

I am unable to load any subpackages on my Linux box. I tested this on Windows (normal python installation) and this same code works fine there.

Syntax: Select all

from os.path import dirname, basename, isfile, join, abspath
import os
import glob
from importlib import import_module
from importlib.util import find_spec

subdir = join(dirname(__file__), "test")
subMod = import_module(subdir)
for file in os.listdir(subdir):
if file.endswith(".py"):
mod = "." + file.replace(".py", "")
print(find_spec(mod, subdir).loader)


Image
arawra
Senior Member
Posts: 190
Joined: Fri Jun 21, 2013 6:51 am

Re: Dynamically loading subpackages

Postby arawra » Mon Sep 07, 2020 8:56 am

Solved, but modified the system in a different way.

Return to “Plugin Development Support”

Who is online

Users browsing this forum: No registered users and 7 guests