Subfolders in lib

Hi all,

i’m am wondering how i can work with subfolder in de Lib folder of an extension.
When i put my .py module inside a subfolder of the lib, pyrevit doesn’t seen to find it once I want to run the script.

In visual studio the linting does work.
below some screenshots of the code and file structure:

from Selection.Sheets import *

image

this is the error i get:

IronPython Traceback:
Traceback (most recent call last):
 File "C:\Users\AlexanderV\AppData\Roaming\pyRevit\Extensions\BBpy.extension\BBpy.tab\Test.panel\ViewsStructure.Pushbutton\script.py", line 22, in <module>
ImportError: No module named Selection.Sheets


Script Executor Traceback:
IronPython.Runtime.Exceptions.ImportException: No module named Selection.Sheets
 at Microsoft.Scripting.Runtime.LightExceptions.ThrowException(LightException lightEx)
 at Microsoft.Scripting.Runtime.LightExceptions.CheckAndThrow(Object value)
 at IronPython.Runtime.Operations.PythonOps.ImportStar(CodeContext context, String fullName, Int32 level)
 at Microsoft.Scripting.Interpreter.ActionCallInstruction`3.Run(InterpretedFrame frame)
 at Microsoft.Scripting.Interpreter.Interpreter.Run(InterpretedFrame frame)
 at Microsoft.Scripting.Interpreter.LightLambda.Run2[T0,T1,TRet](T0 arg0, T1 arg1)
 at IronPython.Compiler.PythonScriptCode.RunWorker(CodeContext ctx)
 at PyRevitLabs.PyRevit.Runtime.IronPythonEngine.Execute(ScriptRuntime& runtime)

thx for the feedback!

Found the error.
There should be an init.py int he lib-folders and every subdirectorie

1 Like