Importing scenes not detected
Description of bug / unexpected behavior
Importing a scene from one file does not expose it in another file.
Expected behavior
I have scenes in multiple files. I was hoping to be able to import them into one main module so I had a single entry point into the animations for this project. I would expect manim to detect the scenes in that module but it does not seem to.
How to reproduce the issue
Code for reproducing the problem
# scene_a.py
from manim import *
class CreateCircle(Scene):
def construct(self):
circle = Circle() # create a circle
circle.set_fill(PINK, opacity=0.5) # set the color and transparency
self.play(Create(circle)) # show the circle on screen
# main.py
from scene_a import CreateCircle
Logs
Terminal output
manim -v DEBUG main.py
Manim Community v0.19.0
[06/03/25 13:24:15] ERROR module_ops.py:93
There are no scenes inside that module
System specifications
System Details
- OS (with version, e.g., Windows 10 v2004 or macOS 10.15 (Catalina)): Linux 6.12.21 x86_64 GNU/Linux
- Python version (
python/py/python3 --version): 3.12.9 - Installed modules (provide output from
pip list):
Package Version
-------------------- -----------
annotated-types 0.7.0
asttokens 3.0.0
av 13.1.0
beautifulsoup4 4.12.3
brotlicffi 1.1.0.0
certifi 2024.12.14
cffi 1.17.1
chardet 5.2.0
charset-normalizer 3.4.1
click 8.1.8
click-default-group 1.2.4
cloup 3.0.5
contourpy 1.3.1
cycler 0.12.1
decorator 5.1.1
executing 2.1.0
fonttools 4.55.3
glcontext 3.0.0
idna 3.10
ipython 8.32.0
isosurfaces 0.1.2
jedi 0.19.2
Jinja2 3.1.5
kiwisolver 1.4.8
lxml 5.3.0
manim 0.19.0
manim-slides 5.4.2
ManimPango 0.6.0
mapbox_earcut 1.0.3
markdown-it-py 3.0.0
MarkupSafe 3.0.2
matplotlib 3.10.0
matplotlib-inline 0.1.7
mdurl 0.1.2
moderngl 5.12.0
moderngl-window 3.1.1
networkx 3.4.2
numpy 2.2.3
packaging 24.2
parso 0.8.4
pexpect 4.9.0
pillow 11.1.0
pip 24.0
prompt_toolkit 3.0.48
ptyprocess 0.7.0
pure_eval 0.2.3
pycairo 1.27.0
pycparser 2.22
pydantic 2.10.5
pydantic_core 2.27.2
pydantic-extra-types 2.10.2
pydub 0.25.1
pyglet 2.0.10
PyGLM 2.7.3
Pygments 2.19.1
pyparsing 3.2.1
python-dateutil 2.9.0.post0
python-pptx 1.0.2
QtPy 2.4.3
requests 2.32.3
rich 13.9.4
rtoml 0.10.0
scipy 1.15.2
screeninfo 0.8.1
semver 3.0.3
six 1.17.0
skia-pathops 0.8.0.post2
soupsieve 2.6
srt 3.5.3
stack_data 0.6.3
svgelements 1.9.6
toml 0.10.2
tqdm 4.67.1
traitlets 5.14.3
typing_extensions 4.12.2
urllib3 2.3.0
watchdog 6.0.0
wcwidth 0.2.13
XlsxWriter 3.2.0
Imported Scenes are purely blocked by this line: https://github.com/ManimCommunity/manim/blob/3d029c1280fc8832503d01c6d729a6563e84c841/manim/utils/module_ops.py#L82
This line has been there from the creationof this functionality. I cannot figure out if there actually is some good reasons not to allow imported Scenes to be found or if this is just Inherited artifact.
I figure it out, this limitation is put into place because all subtypes of Scene still are in same import space. So those will appear alongside with user Scenes.
If you adapt your code to the following, you should be able to render the scene named CreateCircleLocal which is identical to the CreateCircle scene defined in scene_a.py.
# main.py
from scene_a import CreateCircle
class CreateCircleLocal(CreateCircle):
...