Quick Reply
Search this Thread
Test Subject
Original Poster
#1 Old 8th May 2025 at 5:19 PM
Default Python Script MOD Not Working Despite MCCC Working Fine
Hello everyone,

I'm trying to create a simple Python script MOD for Sims 4 (version 1.114.46.1030), but I'm facing an unusual problem. While MC Command Center works perfectly and I can use all its commands, none of my own script MODs will work, even the simplest ones.

Here's what I've tried so far:

1. Created a basic Python script with a simple command:
```python
import sims4.commands

@sims4.commands.Command('test_cmd', command_type=sims4.commands.CommandType.Live)
def test_command(_connection=None):
output = sims4.commands.CheatOutput(_connection)
output("Test command works!")
return True

2.I've tried multiple approaches:

Direct Python files in Mods folder
Python files in a subfolder with init.py
Creating .ts4script packages
Using tuning packages with Python scripts


3.I've confirmed:

Script MODs are enabled in game options
My resource.cfg has "DirectoryFiles * *.py"
MCCC commands work fine (mc_help displays correctly)
Cleared cache files and tried with all other MODs removed



No matter what I do, my commands don't appear in the console. I don't get any errors - they just don't work at all.
My ultimate goal is to create a MOD that displays multiple Sims' needs/motives in the cheat console. I want to be able to see hunger, energy, fun, social, hygiene, and bladder levels for all Sims in the active household with a single command. Here's what I'm trying to implement:


Python code

import sims4.commands
import services

@sims4.commands.Command('show_needs', command_type=sims4.commands.CommandType.Live)
def show_needs(_connection=None):
output = sims4.commands.CheatOutput(_connection)
output("Displaying needs for all household Sims...")

client = services.client_manager().get_first_client()
if client is None:
output("Client not found")
return False

# Get active household
household = client.household
if household is None:
output("Household not found")
return False

# Display needs for each Sim
for sim_info in household.sim_info_gen():
output(f"--- {sim_info.first_name} {sim_info.last_name}'s Needs ---")

# Main needs and their statistic IDs
needs = {
'Hunger': 16656,
'Energy': 16654,
'Social': 16657,
'Fun': 16655,
'Hygiene': 16658,
'Bladder': 16652
}

for name, stat_id in needs.items():
value = sim_info.get_stat_value(stat_id)
if value is not None:
percentage = int(value * 100)
output(f" {name}: {percentage}%")
else:
output(f" {name}: Unknown")

output("----------------")

return True

However, I can't even get the simplest test command to work, so I'm stuck at the very beginning.
Is there something specific about the latest game version that requires a different approach to script MODs? Or could there be something else I'm missing?
Any help would be greatly appreciated!
Test Subject
#2 Old 11th May 2025 at 6:47 AM
I compiled your code and ran the test command, and it does work in my game. Your issue may be the folder layout in your .ts4script file.
I've attached a working compiled copy of your test command with the source code included so you can check for yourself if your mod's .ts4script layout matches.

Also note that if your mods ever fail to compile, the most likely culprit will be the enums.py file from the de-compiled EA scripts which you should either rename or delete
Attached files:
File Type: zip  BearlyBearable_Test.zip (750 Bytes, 16 downloads)
Back to top